summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-23 21:36:49 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-23 21:36:49 -0400
commit32b9ddd62915d913037c9c6df6c3ac78c3d15858 (patch)
treeee16ead767e0ec7455fb17cf0113f489676b7a83 /tests
parentd2543065bfc62c54bc11cb5448495ac5cf4cbb2a (diff)
downloadcmd2-git-32b9ddd62915d913037c9c6df6c3ac78c3d15858.tar.gz
Increased coverage
Diffstat (limited to 'tests')
-rw-r--r--tests/test_history.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/test_history.py b/tests/test_history.py
index 88f38172..2da34cfd 100644
--- a/tests/test_history.py
+++ b/tests/test_history.py
@@ -477,16 +477,21 @@ def test_history_edit(base_app, monkeypatch):
# going to call it due to the mock
base_app.editor = 'fooedit'
- # Mock out the Popen call so we don't actually open an editor
- m = mock.MagicMock(name='Popen')
- monkeypatch.setattr("subprocess.Popen", m)
+ # Mock out the edit call so we don't actually open an editor
+ edit_mock = mock.MagicMock(name='do_edit')
+ monkeypatch.setattr("cmd2.Cmd.do_edit", edit_mock)
+
+ # Mock out the run_script call since the mocked edit won't produce a file
+ run_script_mock = mock.MagicMock(name='do_run_script')
+ monkeypatch.setattr("cmd2.Cmd.do_run_script", run_script_mock)
# Run help command just so we have a command in history
run_cmd(base_app, 'help')
run_cmd(base_app, 'history -e 1')
- # We have an editor, so should expect a Popen call
- m.assert_called_once()
+ # Make sure both functions were called
+ edit_mock.assert_called_once()
+ run_script_mock.assert_called_once()
def test_history_run_all_commands(base_app):
# make sure we refuse to run all commands as a default