summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-03-13 18:13:01 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-03-13 18:13:01 -0400
commit3747fb893bddd7b77373df885d94f25da98ab738 (patch)
treeb5f2543a73335582da1d82a48f043bdf0378cd57 /tests/test_cmd2.py
parent258ad43a8fedd37d4aca5c3694e20a052b88ffbe (diff)
downloadcmd2-git-3747fb893bddd7b77373df885d94f25da98ab738.tar.gz
Added ability to place the command name in a disabled command message. This is useful when disabling an entire category of commands.
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 4743744a..44ca89e0 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -2280,3 +2280,11 @@ def test_disabled_command_not_in_history(disable_commands_app):
saved_len = len(disable_commands_app.history)
run_cmd(disable_commands_app, 'has_help_func')
assert saved_len == len(disable_commands_app.history)
+
+def test_disabled_message_command_name(disable_commands_app, capsys):
+ message_to_print = '{} is currently disabled'.format(cmd2.cmd2.COMMAND_NAME)
+ disable_commands_app.disable_command('has_help_func', message_to_print)
+
+ run_cmd(disable_commands_app, 'has_help_func')
+ out, err = capsys.readouterr()
+ assert err.startswith('has_help_func is currently disabled')