From 9701401946e6d75b953e580e782f7eb79e103253 Mon Sep 17 00:00:00 2001 From: Aaron Lichtman Date: Mon, 18 Nov 2019 14:51:41 +0100 Subject: [PATCH] Fix test? --- features/steps/core.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/features/steps/core.py b/features/steps/core.py index 2ec9e416..0e4e2a75 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -101,12 +101,18 @@ def _mock_input(inputs): @when('we run "{command}" and enter') +@when('we run "{command}" and enter ""') @when('we run "{command}" and enter "{inputs1}"') @when('we run "{command}" and enter "{inputs1}" and "{inputs2}"') def run_with_input(context, command, inputs1="", inputs2=""): # create an iterator through all inputs. These inputs will be fed one by one # to the mocked calls for 'input()', 'util.getpass()' and 'sys.stdin.read()' - text = iter((inputs1, inputs2)) if inputs1 else iter(context.text.split("\n")) + if inputs1: + text = iter((inputs1, inputs2)) + elif context.text: + text = iter(context.text.split("\n")) + else: + text = "" args = ushlex(command)[1:] with patch("builtins.input", side_effect=_mock_input(text)) as mock_input: with patch("jrnl.util.getpass", side_effect=_mock_getpass(text)) as mock_getpass: