diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-06-05 11:32:44 +0200 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2020-06-05 13:47:18 +0000 |
commit | df5004b094fb34c72eb7c96961a466a2b6f69f22 (patch) | |
tree | a88cee7020705db6624af7efb8449ae6c62852ff /test | |
parent | 33a15ff45fdd97aac87f73f24b7af65948753640 (diff) |
Add test case for invalid '--count' option value
Change-Id: Ib46c26889f01ce0cd9d90865070d5c5ac9b5d08a
Issue-ID: INT-1613
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test')
-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([]) |