Raise CalledProcessError as side effect

This commit is contained in:
Ruben van Staveren 2023-01-15 18:10:48 +01:00
parent 32032de81d
commit d43a574579
Signed by: ruben
GPG Key ID: 886F6BECD477A93F

View File

@ -94,9 +94,13 @@ def test_list_nonexistent_table(client, mocker, valid_credentials):
run_res.returncode = 255
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,
side_effect=CalledProcessError(run_res.returncode,
'foobar',
output=run_res.stdout,
stderr=run_res.stderr)
)
response = client.get("/list/nonexistent",
headers={"Authorization":