summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py30
1 files changed, 16 insertions, 14 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index e07e6af3..d250af26 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -69,7 +69,7 @@ def test_base_argparse_help(base_app, capsys):
assert out1 == out2
assert out1[0].startswith('Usage: set')
assert out1[1] == ''
- assert out1[2].startswith('Sets a settable parameter')
+ assert out1[2].startswith('Set a settable parameter')
def test_base_invalid_option(base_app, capsys):
run_cmd(base_app, 'set -z')
@@ -476,7 +476,7 @@ def test_load_with_empty_args(base_app, capsys):
out, err = capsys.readouterr()
# The load command requires a file path argument, so we should get an error message
- assert "load command requires a file path" in str(err)
+ assert "the following arguments are required" in str(err)
assert base_app.cmdqueue == []
@@ -862,7 +862,8 @@ def test_edit_file(base_app, request, monkeypatch):
run_cmd(base_app, 'edit {}'.format(filename))
# We think we have an editor, so should expect a system call
- m.assert_called_once_with('"{}" "{}"'.format(base_app.editor, filename))
+ m.assert_called_once_with('{} {}'.format(utils.quote_string_if_needed(base_app.editor),
+ utils.quote_string_if_needed(filename)))
def test_edit_file_with_spaces(base_app, request, monkeypatch):
# Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock
@@ -878,7 +879,8 @@ def test_edit_file_with_spaces(base_app, request, monkeypatch):
run_cmd(base_app, 'edit "{}"'.format(filename))
# We think we have an editor, so should expect a system call
- m.assert_called_once_with('"{}" "{}"'.format(base_app.editor, filename))
+ m.assert_called_once_with('{} {}'.format(utils.quote_string_if_needed(base_app.editor),
+ utils.quote_string_if_needed(filename)))
def test_edit_blank(base_app, monkeypatch):
# Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock
@@ -1253,17 +1255,17 @@ diddly This command does diddly
Other
================================================================================
-alias Manages aliases
+alias Manage aliases
help List available commands with "help" or detailed help with "help cmd"
history View, run, edit, save, or clear previously entered commands
-load Runs commands in script file that is encoded as either ASCII or UTF-8 text
-macro Manages macros
-py Invoke python command, shell, or script
-pyscript Runs a python script file inside the console
-quit Exits this application
-set Sets a settable parameter or shows current settings of parameters
+load Run commands in script file that is encoded as either ASCII or UTF-8 text
+macro Manage macros
+py Invoke python command or shell
+pyscript Run a python script file inside the console
+quit Exit this application
+set Set a settable parameter or shows current settings of parameters
shell Execute a command as if at the OS prompt
-shortcuts Lists shortcuts available
+shortcuts List shortcuts available
Undocumented commands:
======================
@@ -1560,7 +1562,7 @@ def test_is_text_file_bad_input(base_app):
def test_eof(base_app):
# Only thing to verify is that it returns True
- assert base_app.do_eof('dont care')
+ assert base_app.do_eof('')
def test_eos(base_app):
sdir = 'dummy_dir'
@@ -1568,7 +1570,7 @@ def test_eos(base_app):
assert len(base_app._script_dir) == 1
# Assert that it does NOT return true
- assert not base_app.do_eos('dont care')
+ assert not base_app.do_eos('')
# And make sure it reduced the length of the script dir list
assert len(base_app._script_dir) == 0