diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-26 00:31:16 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-09-26 00:31:16 -0400 |
commit | e0b289b940cd18adab173f65f0413a9575525860 (patch) | |
tree | 41f249bd71daa392555c012e1235aa71aaade2a1 /tests/test_cmd2.py | |
parent | c5b8655ca1d76966665eb5735ca9b8f62aee24c1 (diff) | |
download | cmd2-git-e0b289b940cd18adab173f65f0413a9575525860.tar.gz |
Added more unit tests
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 430e28dd..e07e6af3 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1779,6 +1779,8 @@ def test_alias_create_with_quotes(base_app, capsys): assert out == normalize('alias create fake help > "out file.txt"') @pytest.mark.parametrize('alias_name', [ + '""', # Blank name + '!no_shortcut', '">"', '"no>pe"', '"no spaces"', @@ -1786,19 +1788,19 @@ def test_alias_create_with_quotes(base_app, capsys): '"noterm;"', 'noembedded"quotes', ]) -def test_create_invalid_alias(base_app, alias_name, capsys): +def test_alias_create_invalid_name(base_app, alias_name, capsys): run_cmd(base_app, 'alias create {} help'.format(alias_name)) out, err = capsys.readouterr() - assert "cannot contain" in err + assert "cannot" in err -def test_create_alias_with_macro_name(base_app, capsys): - macro_name = "my_macro" - run_cmd(base_app, 'macro create {} help'.format(macro_name)) - run_cmd(base_app, 'alias create {} help'.format(macro_name)) +def test_alias_create_with_macro_name(base_app, capsys): + macro = "my_macro" + run_cmd(base_app, 'macro create {} help'.format(macro)) + run_cmd(base_app, 'alias create {} help'.format(macro)) out, err = capsys.readouterr() assert "cannot have the same name" in err -def test_create_alias_with_empty_command(base_app, capsys): +def test_alias_create_with_empty_command(base_app, capsys): run_cmd(base_app, 'alias create my_alias ""') out, err = capsys.readouterr() assert "cannot resolve to an empty command" in err |