diff options
-rw-r--r-- | test/mocks/mass-pnf-sim/test_cli.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/mocks/mass-pnf-sim/test_cli.py b/test/mocks/mass-pnf-sim/test_cli.py index f574a725d..0f464167a 100644 --- a/test/mocks/mass-pnf-sim/test_cli.py +++ b/test/mocks/mass-pnf-sim/test_cli.py @@ -39,12 +39,30 @@ def test_validate_trigger_custom(parser, caplog): 'status' ]) def test_count_option(parser, capsys, subcommand): + '''Test case where no arg passed to '--count' opt''' try: parser.parse_args([subcommand, '--count']) except SystemExit: pass assert f"{subcommand}: error: argument --count: expected one argument" in capsys.readouterr().err +@pytest.mark.parametrize(("subcommand"), [ + 'start', + 'stop', + 'trigger', + 'status' + ]) +def test_count_option_bad_value(parser, caplog, subcommand): + '''Test case where invalid value passed to '--count' opt''' + try: + args = parser.parse_args([subcommand, '--count', str(SIM_INSTANCES + 1)]) + m = getattr(MassPnfSim(args), subcommand) + m() + except SystemExit: + pass + assert '--count value greater that existing instance count' in caplog.text + caplog.clear() + def test_empty(parser, capsys): try: parser.parse_args([]) |