diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-09-17 22:53:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 22:53:19 -0400 |
commit | d348f09cf848a566a43b30e04aa6d3adbc4de8bc (patch) | |
tree | 14e106808d87fba76633364905163789089dadfc /tests | |
parent | 92b8a38d66d255027a0440c45582d319f2694aab (diff) | |
parent | 7d5836830d1943af4dfa71ca5b84255c98ef8482 (diff) | |
download | cmd2-git-d348f09cf848a566a43b30e04aa6d3adbc4de8bc.tar.gz |
Merge pull request #999 from python-cmd2/silence1.3.10
Added way to silence alias/macro creation
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_cmd2.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index be6f52d1..1e4f4844 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1624,6 +1624,21 @@ def test_alias_create(base_app): out, err = run_cmd(base_app, 'alias list fake') assert out == normalize('alias create fake run_pyscript') + # Overwrite alias + out, err = run_cmd(base_app, 'alias create fake help') + assert out == normalize("Alias 'fake' overwritten") + + # Look up the updated alias + out, err = run_cmd(base_app, 'alias list fake') + assert out == normalize('alias create fake help') + + # Test silent flag + out, err = run_cmd(base_app, 'alias create --silent fake set') + assert not out + + out, err = run_cmd(base_app, 'alias list --with_silent fake') + assert out == normalize('alias create --silent fake set') + def test_alias_create_with_quoted_value(base_app): """Demonstrate that quotes in alias value will be preserved (except for redirectors and terminators)""" @@ -1718,6 +1733,21 @@ def test_macro_create(base_app): out, err = run_cmd(base_app, 'macro list fake') assert out == normalize('macro create fake run_pyscript') + # Overwrite macro + out, err = run_cmd(base_app, 'macro create fake help') + assert out == normalize("Macro 'fake' overwritten") + + # Look up the updated macro + out, err = run_cmd(base_app, 'macro list fake') + assert out == normalize('macro create fake help') + + # Test silent flag + out, err = run_cmd(base_app, 'macro create --silent fake set') + assert not out + + out, err = run_cmd(base_app, 'macro list --with_silent fake') + assert out == normalize('macro create --silent fake set') + def test_macro_create_with_quoted_value(base_app): """Demonstrate that quotes in macro value will be preserved (except for redirectors and terminators)""" # Create the macro |