summaryrefslogtreecommitdiff
path: root/tests/test_transcript.py
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-06-19 10:06:20 -0600
committerkotfu <kotfu@kotfu.net>2018-06-19 10:06:20 -0600
commit101395a437ef66846e207c039a12ee946128fab9 (patch)
tree4e024a7899396f4e111bda10f2cd8c053db12a5b /tests/test_transcript.py
parentb0a0251c77e73a3f3c0a755f3fabb9fdf136ccfa (diff)
parentb5def934f4d368a7e1a1fe67a98b3cdcc14cd2d9 (diff)
downloadcmd2-git-101395a437ef66846e207c039a12ee946128fab9.tar.gz
Merge branch 'master' into plugin_functions
Diffstat (limited to 'tests/test_transcript.py')
-rw-r--r--tests/test_transcript.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 302d80c8..3caf6a37 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -154,6 +154,32 @@ this is a \/multiline\/ command
assert transcript == expected
+def test_history_transcript_bad_filename(request, capsys):
+ app = CmdLineApp()
+ app.stdout = StdOut()
+ run_cmd(app, 'orate this is\na /multiline/\ncommand;\n')
+ run_cmd(app, 'speak /tmp/file.txt is not a regex')
+
+ expected = r"""(Cmd) orate this is
+> a /multiline/
+> command;
+this is a \/multiline\/ command
+(Cmd) speak /tmp/file.txt is not a regex
+\/tmp\/file.txt is not a regex
+"""
+
+ # make a tmp file
+ history_fname = '~/fakedir/this_does_not_exist.txt'
+
+ # tell the history command to create a transcript
+ run_cmd(app, 'history -t "{}"'.format(history_fname))
+
+ # read in the transcript created by the history command
+ with pytest.raises(FileNotFoundError):
+ with open(history_fname) as f:
+ transcript = f.read()
+ assert transcript == expected
+
@pytest.mark.parametrize('expected, transformed', [
# strings with zero or one slash or with escaped slashes means no regular
# expression present, so the result should just be what re.escape returns.