diff options
Diffstat (limited to 'tests/test_transcript.py')
-rw-r--r-- | tests/test_transcript.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py index 8b38c671..a4102bc8 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -5,8 +5,10 @@ Cmd2 functional testing based on transcript Copyright 2016 Federico Ceratto <federico.ceratto@gmail.com> Released under MIT license, see LICENSE file """ +import sys import pytest +from mock import patch from cmd2 import Cmd, make_option, options, Cmd2TestCase from conftest import run_cmd, StdOut, normalize @@ -212,4 +214,14 @@ def test_optarser_options_with_spaces_in_quotes(_demo_app): assert out == expected +def test_commands_at_invocation(_cmdline_app): + testargs = ["prog", "say hello", "say Gracie", "quit"] + expected = "hello\nGracie\n" + with patch.object(sys, 'argv', testargs): + app = CmdLineApp() + app.stdout = StdOut() + app.cmdloop() + out = app.stdout.buffer + assert out == expected + |