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.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index d352bd4e..a27c5f2b 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -463,7 +463,7 @@ def test_base_py_interactive(base_app):
m.assert_called_once()
-def test_base_cmdloop_with_queue(capsys):
+def test_base_cmdloop_with_queue():
# Create a cmd2.Cmd() instance and make sure basic settings are like we want for test
app = cmd2.Cmd()
app.use_rawinput = True
@@ -479,3 +479,15 @@ def test_base_cmdloop_with_queue(capsys):
app.cmdloop()
out = app.stdout.buffer
assert out == expected
+
+
+def test_input_redirection(base_app, request):
+ test_dir = os.path.dirname(request.module.__file__)
+ filename = os.path.join(test_dir, 'redirect.txt')
+
+ # NOTE: File 'redirect.txt" contains 1 word "history"
+
+ # Verify that redirecting input from a file works
+ out = run_cmd(base_app, 'help < {}'.format(filename))
+ expected = normalize(HELP_HISTORY)
+ assert out == expected