blob: 7ad05ff3c717a1085af829a9db4e4d496d54c759 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
import pytest
from common import process
@pytest.fixture()
def accel_pppd_config():
return """
[modules]
pppoe
[log]
log-debug=/dev/stdout
level=5
[cli]
tcp=127.0.0.1:2001
"""
# test pcre-related negative cases
def test_pcre_negative_cases(accel_pppd_instance, accel_cmd):
# test that accel-pppd started successfully
assert accel_pppd_instance
(exit_sh_sess, out_sh_sess, err_sh_sess) = process.run([accel_cmd, "show sessions match username 00("])
# test that 'show sessions' with invalid regexp reports the issue and error position
assert (
exit_sh_sess == 0
and len(out_sh_sess) > 0
and err_sh_sess == ""
and "match: " in out_sh_sess
and "at 3" in out_sh_sess
)
(exit_iface_add, out_iface_add, err_iface_add) = process.run([accel_cmd, "pppoe interface add re:000("])
# test that 'pppoe interface add' with invalid regexp reports the issue and error position
assert (
exit_iface_add == 0
and len(out_iface_add) > 0
and err_iface_add == ""
and "pppoe: " in out_iface_add
and "at 4" in out_iface_add
)
(exit_term, out_term, err_term) = process.run([accel_cmd, "terminate match username 00("])
# test that 'terminate' with invalid regexp reports the issue and error position
assert (
exit_term == 0
and len(out_term) > 0
and err_term == ""
and "match: " in out_term
and "at 3" in out_term
)
|