Compare commits
No commits in common. "32032de81da28ef2634055c9007dda8329804fdb" and "ea325b06867118be0ad27f288f32ed01f8db1828" have entirely different histories.
32032de81d
...
ea325b0686
@ -94,7 +94,7 @@ def create_app():
|
|||||||
verbose=True)
|
verbose=True)
|
||||||
result = [entry.groupdict() for entry in
|
result = [entry.groupdict() for entry in
|
||||||
re.finditer(_PFCTL_TABLE_PAT,
|
re.finditer(_PFCTL_TABLE_PAT,
|
||||||
'\n'.join([x.decode('ascii') for x in res]),
|
'\n'.join(res),
|
||||||
re.MULTILINE|re.VERBOSE)]
|
re.MULTILINE|re.VERBOSE)]
|
||||||
|
|
||||||
return jsonify({'anchor': f'f2b-jail/{remote_user}',
|
return jsonify({'anchor': f'f2b-jail/{remote_user}',
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
Tests for /list route
|
Tests for /list route
|
||||||
'''
|
'''
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from subprocess import CalledProcessError
|
|
||||||
|
|
||||||
|
|
||||||
_PF_TABLE_LIST = b''' 192.0.2.66
|
_PF_TABLE_LIST = b''' 192.0.2.66
|
||||||
@ -76,7 +75,7 @@ def test_list_single_table(client, mocker, valid_credentials):
|
|||||||
headers={"Authorization":
|
headers={"Authorization":
|
||||||
"Basic " + valid_credentials})
|
"Basic " + valid_credentials})
|
||||||
|
|
||||||
assert response.json['table'] == 'f2b-sshd'
|
assert response.json['anchor'] == 'f2b-sshd/test.example.com'
|
||||||
assert response.json['result'] == _LIST_RESULT
|
assert response.json['result'] == _LIST_RESULT
|
||||||
|
|
||||||
|
|
||||||
@ -89,13 +88,10 @@ def test_list_nonexistent_table(client, mocker, valid_credentials):
|
|||||||
|
|
||||||
run_res = SimpleNamespace()
|
run_res = SimpleNamespace()
|
||||||
run_res.stdout = b''
|
run_res.stdout = b''
|
||||||
run_res.stderr = b'No ALTQ support in kernel\nALTQ related functions disabled\n' \
|
run_res.stderr = b'No ALTQ support in kernel\nALTQ related functions disabled\n'
|
||||||
b'pfctl: Table does not exist.\n'
|
|
||||||
run_res.returncode = 255
|
run_res.returncode = 255
|
||||||
run_res.check_returncode = noop
|
run_res.check_returncode = noop
|
||||||
|
|
||||||
# XXX raise a CalledProcessError here...
|
|
||||||
|
|
||||||
mocker.patch('jail2ban.pfctl.run', return_value=run_res)
|
mocker.patch('jail2ban.pfctl.run', return_value=run_res)
|
||||||
|
|
||||||
response = client.get("/list/nonexistent",
|
response = client.get("/list/nonexistent",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user