summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-06-28 19:05:25 -0400
committerGitHub <noreply@github.com>2017-06-28 19:05:25 -0400
commit63c17bbefdea43a7839b333eb2af44e12bdde53f (patch)
treeea8632f40502947d34c3d14d20c6d64a470ea712 /tests/test_cmd2.py
parent28b5a6b8667f2e105c6c38ef9cf341a0087006fb (diff)
parentf5224cf0af76c639007763c351d1b9fa02ee1208 (diff)
downloadcmd2-git-63c17bbefdea43a7839b333eb2af44e12bdde53f.tar.gz
Merge pull request #143 from python-cmd2/no_url_load
Refactored to remove a few things that felt out of place
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py21
1 files changed, 5 insertions, 16 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 4fd9ca1c..5ca95275 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -283,18 +283,13 @@ load {}
assert out == expected
-def test_base_load_default_file(base_app, capsys):
- # TODO: Make sure to remove the 'command.txt' file in case it exists
-
+def test_base_load_with_empty_args(base_app, capsys):
# The way the load command works, we can't directly capture its stdout or stderr
run_cmd(base_app, 'load')
out, err = capsys.readouterr()
- # The default file 'command.txt' doesn't exist, so we should get an error message
- expected = normalize("""ERROR: Problem accessing script from command.txt:
-[Errno 2] No such file or directory: 'command.txt.txt'
-To enable full traceback, run the following command: 'set debug true'
-""")
+ # The load command requires a file path argument, so we should get an error message
+ expected = normalize("""ERROR: load command requires a file path:\n""")
assert normalize(str(err)) == expected
@@ -550,10 +545,7 @@ def test_edit_number(base_app):
run_cmd(base_app, 'edit 1')
# We have an editor, so should expect a system call
- m.assert_called_once_with('{} {}'.format(base_app.editor, base_app.default_file_name))
-
- # Editing history item causes a file of default name to get created, remove it so we have a clean slate
- os.remove(base_app.default_file_name)
+ m.assert_called_once()
def test_edit_blank(base_app):
@@ -570,10 +562,7 @@ def test_edit_blank(base_app):
run_cmd(base_app, 'edit')
# We have an editor, so should expect a system call
- m.assert_called_once_with('{} {}'.format(base_app.editor, base_app.default_file_name))
-
- # Editing history item causes a file of default name to get created, remove it so we have a clean slate
- os.remove(base_app.default_file_name)
+ m.assert_called_once()
def test_base_py_interactive(base_app):