Fix for tests not handling multiple input prompts

This commit is contained in:
dbxnr 2020-01-10 19:18:25 +00:00
parent 9d9f61ac1e
commit 79142bf651
4 changed files with 25 additions and 7 deletions

View file

@ -43,7 +43,10 @@ Feature: Basic reading and writing to a journal
Scenario: Writing an entry at the prompt Scenario: Writing an entry at the prompt
Given we use the config "basic.yaml" Given we use the config "basic.yaml"
When we run "jrnl" and enter "25 jul 2013: I saw Elvis. He's alive." When we run "jrnl" and enter
"""
25 jul 2013: I saw Elvis. He's alive.
"""
Then we should get no error Then we should get no error
and the journal should contain "[2013-07-25 09:00] I saw Elvis." and the journal should contain "[2013-07-25 09:00] I saw Elvis."
and the journal should contain "He's alive." and the journal should contain "He's alive."

View file

@ -29,7 +29,10 @@ Feature: Reading and writing to journal with custom date formats
Scenario: Writing an entry at the prompt Scenario: Writing an entry at the prompt
Given we use the config "little_endian_dates.yaml" Given we use the config "little_endian_dates.yaml"
When we run "jrnl" and enter "2013-05-10: I saw Elvis. He's alive." When we run "jrnl" and enter
"""
2013-05-10: I saw Elvis. He's alive.
"""
Then we should get no error Then we should get no error
And the journal should contain "[10.05.2013 09:00] I saw Elvis." And the journal should contain "[10.05.2013 09:00] I saw Elvis."
And the journal should contain "He's alive." And the journal should contain "He's alive."

View file

@ -1,13 +1,19 @@
Feature: Encrypted journals Feature: Encrypted journals
Scenario: Loading an encrypted journal Scenario: Loading an encrypted journal
Given we use the config "encrypted.yaml" Given we use the config "encrypted.yaml"
When we run "jrnl -n 1" and enter "bad doggie no biscuit" When we run "jrnl -n 1" and enter
"""
bad doggie no biscuit
"""
Then the output should contain "Password" Then the output should contain "Password"
And the output should contain "2013-06-10 15:40 Life is good" And the output should contain "2013-06-10 15:40 Life is good"
Scenario: Decrypting a journal Scenario: Decrypting a journal
Given we use the config "encrypted.yaml" Given we use the config "encrypted.yaml"
When we run "jrnl --decrypt" and enter "bad doggie no biscuit" When we run "jrnl --decrypt" and enter
""""
bad doggie no biscuit
"""
Then the config for journal "default" should have "encrypt" set to "bool:False" Then the config for journal "default" should have "encrypt" set to "bool:False"
Then we should see the message "Journal decrypted" Then we should see the message "Journal decrypted"
And the journal should have 2 entries And the journal should have 2 entries
@ -23,7 +29,10 @@
""" """
Then we should see the message "Journal encrypted" Then we should see the message "Journal encrypted"
And the config for journal "default" should have "encrypt" set to "bool:True" And the config for journal "default" should have "encrypt" set to "bool:True"
When we run "jrnl -n 1" and enter "swordfish" When we run "jrnl -n 1" and enter
"""
swordfish
"""
Then the output should contain "Password" Then the output should contain "Password"
And the output should contain "2013-06-10 15:40 Life is good" And the output should contain "2013-06-10 15:40 Life is good"
@ -41,7 +50,10 @@
Then we should see the message "Passwords did not match" Then we should see the message "Passwords did not match"
And we should see the message "Journal encrypted" And we should see the message "Journal encrypted"
And the config for journal "default" should have "encrypt" set to "bool:True" And the config for journal "default" should have "encrypt" set to "bool:True"
When we run "jrnl -n 1" and enter "swordfish" When we run "jrnl -n 1" and enter
"""
swordfish
"""
Then the output should contain "Password" Then the output should contain "Password"
And the output should contain "2013-06-10 15:40 Life is good" And the output should contain "2013-06-10 15:40 Life is good"

View file

@ -126,7 +126,7 @@ def run_with_input(context, command, inputs=""):
if context.text: if context.text:
text = iter(context.text.split("\n")) text = iter(context.text.split("\n"))
else: else:
text = iter([inputs]) text = iter(inputs.split(" "))
args = ushlex(command)[1:] args = ushlex(command)[1:]