Skip to content

Commit 6cd0fc9

Browse files
committed
Test deprecated get_cli_args() function
1 parent 73aa177 commit 6cd0fc9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
"""test the cli built-in analyzer"""
33

4+
import sys
45
from contextlib import redirect_stderr, redirect_stdout
56
from io import StringIO
67
from unittest.mock import MagicMock, patch
@@ -97,3 +98,13 @@ def test_keyboardinterrupt(self, spec_from_loader: MagicMock) -> None:
9798
with redirect_stdout(StringIO()) as stdout:
9899
cli.main()
99100
self.assertEqual(stdout.getvalue(), "\n")
101+
102+
@patch("sys.argv", [cli.__file__, "-c", "Jane Fernbrook", "message_totals"])
103+
def test_cli_get_cli_args(self) -> None:
104+
"""should call the deprecated get_cli_args() function"""
105+
# Ensure that CLI is run so did_user_invoke_cli_directly is set to True
106+
with redirect_stdout(StringIO()):
107+
cli.main()
108+
cli_args = cli.get_cli_args()
109+
self.assertEqual(cli_args.contact_name, sys.argv[2])
110+
self.assertEqual(cli_args.analyzer, sys.argv[3])

0 commit comments

Comments
 (0)