diff options
Diffstat (limited to 'tests/cli_test.py')
-rw-r--r-- | tests/cli_test.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/cli_test.py b/tests/cli_test.py index f12e8fed..f9861dee 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -1,4 +1,5 @@ import pytest +import mock from func.cli import cli @@ -16,5 +17,18 @@ class TestClass: def test_cli_error(self, capfd, test_input, expected): with pytest.raises(SystemExit): cli(test_input) - resout, reserr = capfd.readouterr() - assert expected in resout + resout, reserr = capfd.readouterr() + assert expected in resout + + @pytest.mark.parametrize("test_input, expected", [ + (['-l', + 'zte-pod1', + '-f', + 'storage'], [('./test_cases/zte-pod1/storage/fio_bm.yaml'), + ('./test_cases/zte-pod1/storage/fio_vm.yaml')]) + ]) + @mock.patch('func.cli.args_handler.prepare_and_run_benchmark') + def test_cli_successful(self, mock_args_handler, test_input, expected): + cli(test_input) + call_list = map(lambda x: mock_args_handler.call_args_list[x][0][0], range(len(expected))) + assert sorted(call_list) == sorted(expected) |