From d43a574579cd7c7db2ae40a4abaf0670d0ee98d9 Mon Sep 17 00:00:00 2001 From: Ruben van Staveren Date: Sun, 15 Jan 2023 18:10:48 +0100 Subject: [PATCH] Raise CalledProcessError as side effect --- tests/test_list.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_list.py b/tests/test_list.py index b7365c4..055331d 100644 --- a/tests/test_list.py +++ b/tests/test_list.py @@ -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":