mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 13:08:31 +02:00
Fix test?
This commit is contained in:
parent
e4012426ca
commit
9701401946
1 changed files with 7 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue