Handle pfctl_cfg_write output as expected
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import base64
|
||||
from types import SimpleNamespace
|
||||
from subprocess import CompletedProcess
|
||||
|
||||
pfctl_stdout_lines = b'''
|
||||
block drop quick proto tcp from <f2b-sendmail-auth> to any port = submission
|
||||
@ -22,7 +22,7 @@ def test_register_unauth(client):
|
||||
def test_register_valid(client, mocker):
|
||||
def noop():
|
||||
pass
|
||||
run_res = SimpleNamespace()
|
||||
run_res = CompletedProcess(args=['true'], returncode=0)
|
||||
run_res.stdout = pfctl_stdout_lines
|
||||
run_res.check_returncode = noop
|
||||
|
||||
@ -37,13 +37,13 @@ def test_register_valid(client, mocker):
|
||||
json=json_payload,
|
||||
headers={"Authorization": "Basic " + valid_credentials})
|
||||
|
||||
assert response.json['action'] == 'delete'
|
||||
assert response.json['action'] == 'stop'
|
||||
|
||||
|
||||
def test_unregister_valid(client, mocker):
|
||||
def noop():
|
||||
pass
|
||||
run_res = SimpleNamespace()
|
||||
run_res = CompletedProcess(args=['true'], returncode=0)
|
||||
run_res.stdout = pfctl_stdout_lines
|
||||
run_res.check_returncode = noop
|
||||
|
||||
@ -64,7 +64,7 @@ def test_unregister_valid(client, mocker):
|
||||
def test_register_invalid(client, mocker):
|
||||
def noop():
|
||||
pass
|
||||
run_res = SimpleNamespace()
|
||||
run_res = CompletedProcess(args=['true'], returncode=0)
|
||||
run_res.stdout = pfctl_stdout_lines
|
||||
run_res.check_returncode = noop
|
||||
|
||||
|
Reference in New Issue
Block a user