Skip to content

Commit 1fe7096

Browse files
committed
Added unit test for the 'generate_route_manifest' CLI
1 parent de9922a commit 1fe7096

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import sys
2+
3+
from pytest_mock import MockerFixture
4+
5+
from murfey.cli.generate_route_manifest import run
6+
7+
8+
def test_run(
9+
mocker: MockerFixture,
10+
):
11+
# Mock out print() and exit()
12+
mock_print = mocker.patch("builtins.print")
13+
mock_exit = mocker.patch("builtins.exit")
14+
15+
# Run the function with its args
16+
sys.argv = ["--debug"]
17+
run()
18+
19+
# Check that the final print message and exit() are called
20+
print_calls = mock_print.call_args_list
21+
last_print_call = print_calls[-1]
22+
last_printed = last_print_call.args[0]
23+
assert last_printed.startswith(
24+
"Route manifest for instrument and backend servers saved to"
25+
)
26+
mock_exit.assert_called_once()

0 commit comments

Comments
 (0)