From 79142bf6512d2be0613a2c2a515ce06cd090d3d0 Mon Sep 17 00:00:00 2001 From: dbxnr Date: Fri, 10 Jan 2020 19:18:25 +0000 Subject: [PATCH] Fix for tests not handling multiple input prompts --- features/core.feature | 5 ++++- features/custom_dates.feature | 5 ++++- features/encryption.feature | 20 ++++++++++++++++---- features/steps/core.py | 2 +- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/features/core.feature b/features/core.feature index c023cd4ca..c958a60fc 100644 --- a/features/core.feature +++ b/features/core.feature @@ -43,7 +43,10 @@ Feature: Basic reading and writing to a journal Scenario: Writing an entry at the prompt 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 and the journal should contain "[2013-07-25 09:00] I saw Elvis." and the journal should contain "He's alive." diff --git a/features/custom_dates.feature b/features/custom_dates.feature index d3489648e..04b0334c3 100644 --- a/features/custom_dates.feature +++ b/features/custom_dates.feature @@ -29,7 +29,10 @@ Feature: Reading and writing to journal with custom date formats Scenario: Writing an entry at the prompt 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 And the journal should contain "[10.05.2013 09:00] I saw Elvis." And the journal should contain "He's alive." \ No newline at end of file diff --git a/features/encryption.feature b/features/encryption.feature index 081a208ff..8d6e9cf3f 100644 --- a/features/encryption.feature +++ b/features/encryption.feature @@ -1,13 +1,19 @@ Feature: Encrypted journals Scenario: Loading an encrypted journal 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" And the output should contain "2013-06-10 15:40 Life is good" Scenario: Decrypting a journal 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 we should see the message "Journal decrypted" And the journal should have 2 entries @@ -23,7 +29,10 @@ """ Then we should see the message "Journal encrypted" 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" 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" And we should see the message "Journal encrypted" 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" And the output should contain "2013-06-10 15:40 Life is good" diff --git a/features/steps/core.py b/features/steps/core.py index af0a657e9..d5dab0b9e 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -126,7 +126,7 @@ def run_with_input(context, command, inputs=""): if context.text: text = iter(context.text.split("\n")) else: - text = iter([inputs]) + text = iter(inputs.split(" ")) args = ushlex(command)[1:]