diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-01 14:11:38 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-07-01 14:11:38 -0400 |
commit | f2f91230b23cbed8f636e663e29e6bb4b1dbe9ee (patch) | |
tree | e3c0c9a3a596b1144daf31500ecbdb2f2623e847 /tests/test_transcript.py | |
parent | 0b6edb1663ba20ece40f8dbba491f6e28911b183 (diff) | |
download | cmd2-git-f2f91230b23cbed8f636e663e29e6bb4b1dbe9ee.tar.gz |
Added more unit tests for the cmd2.Cmd.select() method
Also
- Moved the existing tests for select to a more appropriate location
- Minor tweak to working in README for readability
Diffstat (limited to 'tests/test_transcript.py')
-rw-r--r-- | tests/test_transcript.py | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py index a31ebd17..d1363f8e 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -68,13 +68,6 @@ class DemoApp(Cmd): else: self.stdout.write('Hello Nobody\n') - def do_eat(self, arg): - """Eat something, with a selection of sauces to choose from.""" - sauce = self.select('sweet salty', 'Sauce? ') - result = '{food} with {sauce} sauce, yum!' - result = result.format(food=arg, sauce=sauce) - self.stdout.write(result + '\n') - @pytest.fixture def _cmdline_app(): @@ -240,27 +233,6 @@ def test_commands_at_invocation(): assert out == expected -def test_select_options(_demo_app): - # Mock out the input call so we don't actually wait for a user's response on stdin - m = mock.MagicMock(name='input', return_value='2') - sm.input = m - - food = 'bacon' - run_cmd(_demo_app, "set debug true") - out = run_cmd(_demo_app, "eat {}".format(food)) - expected = normalize(""" - 1. sweet - 2. salty -{} with salty sauce, yum! -""".format(food)) - - # Make sure our mock was called with the expected arguments - m.assert_called_once_with('Sauce? ') - - # And verify the expected output to stdout - assert out == expected - - def test_transcript_from_cmdloop(request, capsys): # Create a cmd2.Cmd() instance and make sure basic settings are like we want for test app = CmdLineApp() |