diff --git a/features/contains.feature b/features/contains.feature index eac3a464..7ecf405f 100644 --- a/features/contains.feature +++ b/features/contains.feature @@ -4,7 +4,7 @@ Feature: Contains Given we use the config "basic.yaml" When we run "jrnl -contains life" Then we should get no error - and the output should be + And the output should be """ 2013-06-10 15:40 Life is good. | But I'm better. @@ -20,10 +20,10 @@ Feature: Contains Given we use the config "tags.yaml" When we run "jrnl -and @journal @idea -contains software" Then we should get no error - and the output should contain "software" + And the output should contain "software" Scenario: Searching for a string within NOT tag results Given we use the config "tags.yaml" When we run "jrnl -not @dan -contains software" Then we should get no error - and the output should contain "software" + And the output should contain "software" diff --git a/features/core.feature b/features/core.feature index b8a987ec..bf103f17 100644 --- a/features/core.feature +++ b/features/core.feature @@ -4,7 +4,7 @@ Feature: Basic reading and writing to a journal Given we use the config "basic.yaml" When we run "jrnl -n 2" Then we should get no error - and the output should be + And the output should be """ 2013-06-09 15:39 My first entry. | Everything is alright @@ -17,7 +17,7 @@ Feature: Basic reading and writing to a journal Given we use the config "multiline.yaml" When we run "jrnl -n 1" Then we should get no error - and the output should be + And the output should be """ 2013-06-09 15:39 Multiple line entry. | This is the first line. @@ -29,13 +29,13 @@ Feature: Basic reading and writing to a journal Scenario: Multiline entry with punctuation Given we use the config "basic.yaml" When we run "jrnl This is. the title\\n This is the second line" - and we run "jrnl -n 1" + And we run "jrnl -n 1" Then the output should contain "This is. the title" Scenario: Single line entry with punctuation Given we use the config "basic.yaml" When we run "jrnl This is. the title" - and we run "jrnl -n 1" + And we run "jrnl -n 1" Then the output should contain "| the title" Scenario: Writing an entry from command line @@ -62,10 +62,7 @@ Feature: Basic reading and writing to a journal Scenario: Writing an empty entry from the command line Given we use the config "basic.yaml" When we run "jrnl" and enter nothing - Then the output should be - """ - - """ + Then the output should be empty Scenario: Filtering for dates Given we use the config "basic.yaml" @@ -80,14 +77,14 @@ Feature: Basic reading and writing to a journal Then we should see the message "Entry added" When we run "jrnl -n 1" Then the output should contain "🌞" - and the output should contain "🐘" + And the output should contain "🐘" 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." 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." + And the journal should contain "[2013-07-25 09:00] I saw Elvis." + And the journal should contain "He's alive." Scenario: Displaying the version number Given we use the config "basic.yaml" @@ -117,18 +114,18 @@ Feature: Basic reading and writing to a journal Scenario: Journal directory does not exist Given we use the config "missing_directory.yaml" When we run "jrnl Life is good" - and we run "jrnl -n 1" + And we run "jrnl -n 1" Then the output should contain "Life is good" Scenario: Installation with relative journal and referencing from another folder Given we use the config "missingconfig" When we run "jrnl hello world" and enter - """ - test.txt - n - """ - and we change directory to "features" - and we run "jrnl -n 1" + """ + test.txt + n + """ + And we change directory to "features" + And we run "jrnl -n 1" Then the output should contain "hello world" Scenario: --diagnostic runs without exceptions diff --git a/features/dayone.feature b/features/dayone.feature index 39abae95..13f0e71b 100644 --- a/features/dayone.feature +++ b/features/dayone.feature @@ -4,7 +4,7 @@ Feature: Dayone specific implementation details. Given we use the config "dayone.yaml" When we run "jrnl -from 'feb 2013'" Then we should get no error - and the output should be + And the output should be """ 2013-05-17 11:39 This entry has tags! @@ -19,16 +19,13 @@ Feature: Dayone specific implementation details. Given we use the config "dayone.yaml" When we run "jrnl -until 'feb 2013'" Then we should get no error - and the output should contain "2013-01-17T18:37Z" in the local time + And the output should contain "2013-01-17T18:37Z" in the local time Scenario: Writing into Dayone Given we use the config "dayone.yaml" When we run "jrnl 01 may 1979: Being born hurts." - and we run "jrnl -until 1980" - Then the output should be - """ - 1979-05-01 09:00 Being born hurts. - """ + And we run "jrnl -until 1980" + Then the output should be "1979-05-01 09:00 Being born hurts." Scenario: Loading tags from a DayOne Journal Given we use the config "dayone.yaml" @@ -42,7 +39,7 @@ Feature: Dayone specific implementation details. Scenario: Saving tags from a DayOne Journal Given we use the config "dayone.yaml" When we run "jrnl A hard day at @work" - and we run "jrnl --tags" + And we run "jrnl --tags" Then the output should be """ @work : 2 @@ -52,44 +49,23 @@ Feature: Dayone specific implementation details. Scenario: Filtering by tags from a DayOne Journal Given we use the config "dayone.yaml" When we run "jrnl @work" - Then the output should be - """ - 2013-05-17 11:39 This entry has tags! - """ + Then the output should be "2013-05-17 11:39 This entry has tags!" Scenario: Exporting dayone to json Given we use the config "dayone.yaml" When we run "jrnl --export json" Then we should get no error - and the output should be parsable as json - and the json output should contain entries.0.uuid = "4BB1F46946AD439996C9B59DE7C4DDC1" + And the output should be parsable as json + And the json output should contain entries.0.uuid = "4BB1F46946AD439996C9B59DE7C4DDC1" Scenario: Writing into Dayone adds extended metadata Given we use the config "dayone.yaml" When we run "jrnl 01 may 1979: Being born hurts." - and we run "jrnl --export json" + And we run "jrnl --export json" Then "entries" in the json output should have 5 elements - and the json output should contain entries.0.creator.software_agent - and the json output should contain entries.0.creator.os_agent - and the json output should contain entries.0.creator.host_name - and the json output should contain entries.0.creator.generation_date - and the json output should contain entries.0.creator.device_agent - and "entries.0.creator.software_agent" in the json output should contain "jrnl" - - Scenario: Editing Dayone with mock editor - Given we use the config "dayone.yaml" - When we run "jrnl --edit" - Then we should get no error - - Scenario: Editing Dayone entries - Given we use the config "dayone.yaml" - When we open the editor and append - """ - Here is the first line. - Here is the second line. - """ - When we run "jrnl -n 1" - Then we should get no error - and the output should contain "This entry is starred!" - and the output should contain "Here is the first line" - and the output should contain "Here is the second line" + And the json output should contain entries.0.creator.software_agent + And the json output should contain entries.0.creator.os_agent + And the json output should contain entries.0.creator.host_name + And the json output should contain entries.0.creator.generation_date + And the json output should contain entries.0.creator.device_agent + And "entries.0.creator.software_agent" in the json output should contain "jrnl" diff --git a/features/dayone_regressions.feature b/features/dayone_regressions.feature index 3e98f9e9..2ece3fbf 100644 --- a/features/dayone_regressions.feature +++ b/features/dayone_regressions.feature @@ -6,10 +6,7 @@ Feature: Zapped Dayone bugs stay dead! # https://github.com/jrnl-org/jrnl/issues/354 Given we use the config "dayone.yaml" When we run "jrnl @plAy" - Then the output should contain - """ - 2013-05-17 11:39 This entry has tags! - """ + Then the output should contain "2013-05-17 11:39 This entry has tags!" # fails when system time is UTC (as on Travis-CI) @skip diff --git a/features/delete.feature b/features/delete.feature index d12fe8f8..32bcfb36 100644 --- a/features/delete.feature +++ b/features/delete.feature @@ -1,29 +1,26 @@ Feature: Delete entries from journal Scenario: --delete flag allows deletion of single entry Given we use the config "deletion.yaml" + Then the journal should have 3 entries When we run "jrnl -n 1" - Then the output should contain - """ - 2019-10-29 11:13 Third entry. - """ + Then the output should contain "2019-10-29 11:13 Third entry." When we run "jrnl --delete" and enter - """ - N - N - Y - """ + """ + N + N + Y + """ + Then the journal should have 2 entries When we run "jrnl -n 1" - Then the output should contain - """ - 2019-10-29 11:11 Second entry. - """ + Then the output should contain "2019-10-29 11:11 Second entry." Scenario: Backing out of interactive delete does not change journal Given we use the config "deletion.yaml" + Then the journal should have 3 entries When we run "jrnl --delete -n 1" and enter - """ - N - """ + """ + N + """ Then the journal should have 3 entries And the journal should contain "[2019-10-29 11:11] First entry." And the journal should contain "[2019-10-29 11:11] Second entry." @@ -31,119 +28,125 @@ Feature: Delete entries from journal Scenario: --delete flag with nonsense input deletes nothing (issue #932) Given we use the config "deletion.yaml" + Then the journal should have 3 entries When we run "jrnl --delete asdfasdf" + Then the journal should have 3 entries When we run "jrnl -n 1" - Then the output should contain - """ - 2019-10-29 11:13 Third entry. - """ - And the journal should have 3 entries + Then the output should contain "2019-10-29 11:13 Third entry." Scenario: --delete flag with tag only deletes tagged entries Given we use the config "deletion_filters.yaml" + Then the journal should have 5 entries When we run "jrnl --delete @holidays" and enter - """ - Y - Y - """ + """ + Y + Y + """ Then the journal should have 3 entries - Then the journal should contain "[2019-10-01 08:00] It's just another day in October." - and the journal should contain "[2020-03-01 08:00] It's just another day in March." - and the journal should contain "[2020-05-02 12:10] Writing tests." + And the journal should contain "[2019-10-01 08:00] It's just another day in October." + And the journal should contain "[2020-03-01 08:00] It's just another day in March." + And the journal should contain "[2020-05-02 12:10] Writing tests." Scenario: --delete flag with multiple tags deletes all entries matching any of the tags Given we use the config "deletion_filters.yaml" + Then the journal should have 5 entries When we run "jrnl --delete @holidays @springtime" and enter - """ - Y - Y - Y - """ - Then the journal should contain "[2019-10-01 08:00] It's just another day in October." - and the journal should not contain "[2020-01-01 08:00] Happy New Year!" - and the journal should contain "[2020-03-01 08:00] It's just another day in March." - and the journal should not contain "[2020-05-01 09:00] Happy May Day!" - and the journal should not contain "[2020-05-02 12:10] Writing tests. *" - and the journal should have 2 entries + """ + Y + Y + Y + """ + Then the journal should have 2 entries + And the journal should contain "[2019-10-01 08:00] It's just another day in October." + And the journal should contain "[2020-03-01 08:00] It's just another day in March." + But the journal should not contain "[2020-01-01 08:00] Happy New Year!" + But the journal should not contain "[2020-05-01 09:00] Happy May Day!" + But the journal should not contain "[2020-05-02 12:10] Writing tests. *" Scenario: --delete flag with -and and tags only deletes boolean AND of tagged entries Given we use the config "deletion_filters.yaml" + Then the journal should have 5 entries When we run "jrnl --delete -and @holidays @springtime" and enter - """ - Y - """ - Then the journal should contain "[2019-10-01 08:00] It's just another day in October." - and the journal should contain "[2020-01-01 08:00] Happy New Year!" - and the journal should contain "[2020-03-01 08:00] It's just another day in March." - and the journal should not contain "[2020-05-01 09:00] Happy May Day!" - and the journal should contain "[2020-05-02 12:10] Writing tests. *" - and the journal should have 4 entries + """ + Y + """ + Then the journal should have 4 entries + And the journal should contain "[2019-10-01 08:00] It's just another day in October." + And the journal should contain "[2020-01-01 08:00] Happy New Year!" + And the journal should contain "[2020-03-01 08:00] It's just another day in March." + And the journal should contain "[2020-05-02 12:10] Writing tests. *" + But the journal should not contain "[2020-05-01 09:00] Happy May Day!" Scenario: --delete flag with -not does not delete entries with -not tag Given we use the config "deletion_filters.yaml" + Then the journal should have 5 entries When we run "jrnl --delete @holidays -not @springtime" and enter - """ - Y - """ - Then the journal should contain "[2019-10-01 08:00] It's just another day in October." - and the journal should not contain "[2020-01-01 08:00] Happy New Year!" - and the journal should contain "[2020-03-01 08:00] It's just another day in March." - and the journal should contain "[2020-05-01 09:00] Happy May Day!" - and the journal should contain "[2020-05-02 12:10] Writing tests. *" - and the journal should have 4 entries + """ + Y + """ + Then the journal should have 4 entries + And the journal should contain "[2019-10-01 08:00] It's just another day in October." + And the journal should contain "[2020-03-01 08:00] It's just another day in March." + And the journal should contain "[2020-05-01 09:00] Happy May Day!" + And the journal should contain "[2020-05-02 12:10] Writing tests. *" + But the journal should not contain "[2020-01-01 08:00] Happy New Year!" Scenario: --delete flag with -from only deletes entries since a specified date Given we use the config "deletion_filters.yaml" + Then the journal should have 5 entries When we run "jrnl --delete -from 2020-01-02" and enter - """ - Y - Y - Y - """ - Then the journal should contain "[2019-10-01 08:00] It's just another day in October." - and the journal should contain "[2020-01-01 08:00] Happy New Year!" - and the journal should not contain "[2020-03-01 08:00] It's just another day in March." - and the journal should not contain "[2020-05-01 09:00] Happy May Day!" - and the journal should not contain "[2020-05-02 12:10] Writing tests." - and the journal should have 2 entries + """ + Y + Y + Y + """ + Then the journal should have 2 entries + And the journal should contain "[2019-10-01 08:00] It's just another day in October." + And the journal should contain "[2020-01-01 08:00] Happy New Year!" + And the journal should not contain "[2020-03-01 08:00] It's just another day in March." + And the journal should not contain "[2020-05-01 09:00] Happy May Day!" + And the journal should not contain "[2020-05-02 12:10] Writing tests." Scenario: --delete flag with -to only deletes entries up to specified date Given we use the config "deletion_filters.yaml" + Then the journal should have 5 entries When we run "jrnl --delete -to 2020-01-02" and enter - """ - Y - Y - """ - Then the journal should not contain "[2019-10-01 08:00] It's just another day in October." - and the journal should not contain "[2020-01-01 08:00] Happy New Year!" - and the journal should contain "[2020-03-01 08:00] It's just another day in March." - and the journal should contain "[2020-05-01 09:00] Happy May Day!" - and the journal should contain "[2020-05-02 12:10] Writing tests." - and the journal should have 3 entries + """ + Y + Y + """ + Then the journal should have 3 entries + And the journal should contain "[2020-03-01 08:00] It's just another day in March." + And the journal should contain "[2020-05-01 09:00] Happy May Day!" + And the journal should contain "[2020-05-02 12:10] Writing tests." + But the journal should not contain "[2019-10-01 08:00] It's just another day in October." + But the journal should not contain "[2020-01-01 08:00] Happy New Year!" Scenario: --delete flag with -starred only deletes starred entries Given we use the config "deletion_filters.yaml" + Then the journal should have 5 entries When we run "jrnl --delete -starred" and enter - """ - Y - """ - Then the journal should contain "[2019-10-01 08:00] It's just another day in October." - and the journal should contain "[2020-01-01 08:00] Happy New Year!" - and the journal should contain "[2020-03-01 08:00] It's just another day in March." - and the journal should contain "[2020-05-01 09:00] Happy May Day!" - and the journal should not contain "[2020-05-02 12:10] Writing tests. *" - and the journal should have 4 entries + """ + Y + """ + Then the journal should have 4 entries + And the journal should contain "[2019-10-01 08:00] It's just another day in October." + And the journal should contain "[2020-01-01 08:00] Happy New Year!" + And the journal should contain "[2020-03-01 08:00] It's just another day in March." + And the journal should contain "[2020-05-01 09:00] Happy May Day!" + But the journal should not contain "[2020-05-02 12:10] Writing tests. *" Scenario: --delete flag with -contains only entries containing expression Given we use the config "deletion_filters.yaml" + Then the journal should have 5 entries When we run "jrnl --delete -contains happy" and enter - """ - Y - Y - """ - Then the journal should contain "[2019-10-01 08:00] It's just another day in October." - and the journal should not contain "[2020-01-01 08:00] Happy New Year!" - and the journal should contain "[2020-03-01 08:00] It's just another day in March." - and the journal should not contain "[2020-05-01 09:00] Happy May Day!" - and the journal should contain "[2020-05-02 12:10] Writing tests. *" - and the journal should have 3 entries + """ + Y + Y + """ + Then the journal should have 3 entries + And the journal should contain "[2019-10-01 08:00] It's just another day in October." + And the journal should contain "[2020-03-01 08:00] It's just another day in March." + And the journal should contain "[2020-05-02 12:10] Writing tests. *" + But the journal should not contain "[2020-01-01 08:00] Happy New Year!" + But the journal should not contain "[2020-05-01 09:00] Happy May Day!" diff --git a/features/encryption.feature b/features/encryption.feature index 02f8b423..6e75cbc6 100644 --- a/features/encryption.feature +++ b/features/encryption.feature @@ -9,17 +9,17 @@ Given we use the config "encrypted.yaml" 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 we should see the message "Journal decrypted" And the journal should have 2 entries Scenario: Encrypting a journal Given we use the config "basic.yaml" When we run "jrnl --encrypt" and enter - """ - swordfish - swordfish - n - """ + """ + swordfish + swordfish + n + """ 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" @@ -29,13 +29,13 @@ Scenario: Mistyping your password Given we use the config "basic.yaml" When we run "jrnl --encrypt" and enter - """ - swordfish - sordfish - swordfish - swordfish - n - """ + """ + swordfish + sordfish + swordfish + swordfish + n + """ 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" @@ -46,36 +46,37 @@ Scenario: Storing a password in Keychain Given we use the config "multiple.yaml" When we run "jrnl simple --encrypt" and enter - """ - sabertooth - sabertooth - y - """ + """ + sabertooth + sabertooth + y + """ When we set the keychain password of "simple" to "sabertooth" Then the config for journal "simple" should have "encrypt" set to "bool:True" When we run "jrnl simple -n 1" Then the output should contain "2013-06-10 15:40 Life is good" + But the output should not contain "Password" Scenario: Encrypt journal with no keyring backend and do not store in keyring Given we use the config "basic.yaml" When we disable the keychain - and we run "jrnl test entry" - and we run "jrnl --encrypt" and enter - """ - password - password - n - """ + And we run "jrnl test entry" + And we run "jrnl --encrypt" and enter + """ + password + password + n + """ Then we should get no error Scenario: Encrypt journal with no keyring backend and do store in keyring Given we use the config "basic.yaml" When we disable the keychain - and we run "jrnl test entry" - and we run "jrnl --encrypt" and enter - """ - password - password - y - """ + And we run "jrnl test entry" + And we run "jrnl --encrypt" and enter + """ + password + password + y + """ Then we should get no error diff --git a/features/environment.py b/features/environment.py index f4d94a7f..b0e208c0 100644 --- a/features/environment.py +++ b/features/environment.py @@ -17,7 +17,7 @@ def before_feature(context, feature): # add "skip" tag # https://stackoverflow.com/a/42721605/4276230 if "skip" in feature.tags: - feature.skip("") + feature.skip() return if "skip_win" in feature.tags and on_windows: @@ -44,7 +44,7 @@ def before_scenario(context, scenario): # add "skip" tag # https://stackoverflow.com/a/42721605/4276230 if "skip" in scenario.effective_tags: - scenario.skip("") + scenario.skip() return if "skip_win" in scenario.effective_tags and on_windows: diff --git a/features/exporting.feature b/features/exporting.feature index 96a9558f..39375a96 100644 --- a/features/exporting.feature +++ b/features/exporting.feature @@ -23,67 +23,67 @@ Feature: Exporting a Journal Scenario: Exporting using custom templates Given we use the config "basic.yaml" - Given we load template "sample.template" + And we load template "sample.template" When we run "jrnl --export sample" Then the output should be - """ - My first entry. - --------------- + """ + My first entry. + --------------- - Everything is alright + Everything is alright - Life is good. - ------------- + Life is good. + ------------- - But I'm better. - """ + But I'm better. + """ Scenario: Increasing Headings on Markdown export Given we use the config "markdown-headings-335.yaml" When we run "jrnl --export markdown" Then the output should be - """ - # 2015 + """ + # 2015 - ## April + ## April - ### 2015-04-14 13:23 Heading Test + ### 2015-04-14 13:23 Heading Test - #### H1-1 + #### H1-1 - #### H1-2 + #### H1-2 - #### H1-3 + #### H1-3 - ##### H2-1 + ##### H2-1 - ##### H2-2 + ##### H2-2 - ##### H2-3 + ##### H2-3 - Horizontal Rules (ignore) + Horizontal Rules (ignore) - --- + --- - === + === - #### ATX H1 + #### ATX H1 - ##### ATX H2 + ##### ATX H2 - ###### ATX H3 + ###### ATX H3 - ####### ATX H4 + ####### ATX H4 - ######## ATX H5 + ######## ATX H5 - ######### ATX H6 + ######### ATX H6 - Stuff + Stuff - More stuff - more stuff again - """ + More stuff + more stuff again + """ Scenario: Exporting to XML Given we use the config "tags.yaml" @@ -97,11 +97,11 @@ Feature: Exporting a Journal Given we use the config "tags.yaml" When we run "jrnl --export tags" Then the output should be - """ - @idea : 2 - @journal : 1 - @dan : 1 - """ + """ + @idea : 2 + @journal : 1 + @dan : 1 + """ Scenario: Exporting fancy Given we use the config "tags.yaml" diff --git a/features/folder.feature b/features/folder.feature index 650ac53e..c1d0f320 100644 --- a/features/folder.feature +++ b/features/folder.feature @@ -5,10 +5,7 @@ Feature: Testing a journal with a root directory and multiple files in the forma When we run "jrnl 23 july 2013: Testing folder journal." Then we should see the message "Entry added" When we run "jrnl -1" - Then the output should be - """ - 2013-07-23 09:00 Testing folder journal. - """ + Then the output should be "2013-07-23 09:00 Testing folder journal." Scenario: Adding entries to a Folder journal should generate date files Given we use the config "empty_folder.yaml" @@ -34,9 +31,9 @@ Feature: Testing a journal with a root directory and multiple files in the forma When we run "jrnl 23 July 2013: Testing folder journal." Then we should see the message "Entry added" When we run "jrnl -2" - Then the output should be + Then the output should be """ 2013-07-23 09:00 Testing folder journal. - + 2014-03-07 16:37 Second entry of journal. """ diff --git a/features/multiple_journals.feature b/features/multiple_journals.feature index 0f41b0d9..eeb8e906 100644 --- a/features/multiple_journals.feature +++ b/features/multiple_journals.feature @@ -3,19 +3,19 @@ Feature: Multiple journals Scenario: Loading a config with two journals Given we use the config "multiple.yaml" Then journal "default" should have 2 entries - and journal "work" should have 0 entries + And journal "work" should have 0 entries Scenario: Write to default config by default Given we use the config "multiple.yaml" When we run "jrnl this goes to default" Then journal "default" should have 3 entries - and journal "work" should have 0 entries + And journal "work" should have 0 entries Scenario: Write to specified journal Given we use the config "multiple.yaml" When we run "jrnl work a long day in the office" Then journal "default" should have 2 entries - and journal "work" should have 1 entry + And journal "work" should have 1 entry Scenario: Tell user which journal was used Given we use the config "multiple.yaml" @@ -26,8 +26,8 @@ Feature: Multiple journals Given we use the config "multiple.yaml" When we run "jrnl work 23 july 2012: a long day in the office" Then journal "default" should have 2 entries - and journal "work" should have 1 entry - and journal "work" should contain "2012-07-23" + And journal "work" should have 1 entry + And journal "work" should contain "2012-07-23" Scenario: Create new journals as required Given we use the config "multiple.yaml" @@ -43,9 +43,9 @@ Feature: Multiple journals Scenario: Don't crash if no file exists for a configured encrypted journal Given we use the config "multiple.yaml" When we run "jrnl new_encrypted Adding first entry" and enter - """ - these three eyes - these three eyes - n - """ - Then we should see the message "Encrypted journal 'new_encrypted' created" + """ + these three eyes + these three eyes + n + """ + Then we should see the message "Encrypted journal 'new_encrypted' created" diff --git a/features/regression.feature b/features/regression.feature index 5342b746..9425280e 100644 --- a/features/regression.feature +++ b/features/regression.feature @@ -13,14 +13,14 @@ Feature: Zapped bugs should stay dead. Given we use the config "basic.yaml" When we run "jrnl 2013-11-30 15:42: Project Started." Then we should see the message "Entry added" - and the journal should contain "[2013-11-30 15:42] Project Started." + And the journal should contain "[2013-11-30 15:42] Project Started." Scenario: Loading entry with ambiguous time stamp #https://github.com/jrnl-org/jrnl/issues/153 Given we use the config "bug153.yaml" When we run "jrnl -1" Then we should get no error - and the output should be + And the output should be """ 2013-10-27 03:27 Some text. """ @@ -30,7 +30,7 @@ Feature: Zapped bugs should stay dead. Given we use the config "basic.yaml" When we run "jrnl 26/06/2019: Planet? Earth. Year? 2019." Then we should see the message "Entry added" - and the journal should contain "[2019-06-26 09:00] Planet?" + And the journal should contain "[2019-06-26 09:00] Planet?" Scenario: Empty DayOne entry bodies should not error # https://github.com/jrnl-org/jrnl/issues/780 @@ -58,7 +58,7 @@ Feature: Zapped bugs should stay dead. Given we use the config "unreadabledates.yaml" When we run "jrnl -2" Then the output should contain "I've lost track of time." - Then the output should contain "Time has no meaning." + And the output should contain "Time has no meaning." Scenario: Journals with readable dates AND unreadable dates should still contain all data. Given we use the config "mostlyreadabledates.yaml" @@ -66,14 +66,14 @@ Feature: Zapped bugs should stay dead. Then the output should contain "Time machines are possible." When we run "jrnl -1" Then the output should contain "I'm going to activate the machine." - Then the output should contain "I've crossed so many timelines. Is there any going back?" + And the output should contain "I've crossed so many timelines. Is there any going back?" Scenario: Viewing today's entries does not print the entire journal # https://github.com/jrnl-org/jrnl/issues/741 Given we use the config "basic.yaml" When we run "jrnl -on today" Then the output should not contain "Life is good" - Then the output should not contain "But I'm better." + And the output should not contain "But I'm better." Scenario: Create entry using day of the week as entry date. Given we use the config "basic.yaml" @@ -81,7 +81,7 @@ Feature: Zapped bugs should stay dead. Then we should see the message "Entry added" When we run "jrnl -1" Then the output should contain "monday at 9am" in the local time - Then the output should contain "This is an entry on a Monday." + And the output should contain "This is an entry on a Monday." Scenario: Create entry using day of the week abbreviations as entry date. Given we use the config "basic.yaml" @@ -107,8 +107,8 @@ Feature: Zapped bugs should stay dead. Then we should see the message "Entry added" When we run "jrnl -from today" Then the output should contain "Adding an entry right now." - Then the output should contain "A future entry." - Then the output should not contain "This thing happened yesterday" + And the output should contain "A future entry." + And the output should not contain "This thing happened yesterday" Scenario: Displaying entries using -from and -to day should display correct entries Given we use the config "basic.yaml" @@ -120,8 +120,8 @@ Feature: Zapped bugs should stay dead. Then we should see the message "Entry added" When we run "jrnl -from yesterday -to today" Then the output should contain "This thing happened yesterday" - Then the output should contain "Adding an entry right now." - Then the output should not contain "A future entry." + And the output should contain "Adding an entry right now." + And the output should not contain "A future entry." # See issues #768 and #881 # the "deletion" journal is used because it doesn't have a newline at the @@ -130,46 +130,46 @@ Feature: Zapped bugs should stay dead. Given we use the config "deletion.yaml" When we run "jrnl --export markdown" Then the output should be - """ - # 2019 + """ + # 2019 - ## October + ## October - ### 2019-10-29 11:11 First entry. + ### 2019-10-29 11:11 First entry. - ### 2019-10-29 11:11 Second entry. + ### 2019-10-29 11:11 Second entry. - ### 2019-10-29 11:13 Third entry. + ### 2019-10-29 11:13 Third entry. - """ + """ # See issues #768 and #881 - Scenario: Add a blank line to YAML export is there isn't one already + Scenario: Add a blank line to YAML export if there isn't one already Given we use the config "deletion.yaml" And we create cache directory "bug768" When we run "jrnl --export yaml -o {cache_dir}" with cache directory "bug768" Then cache directory "bug768" should contain the files - """ - [ - "2019-10-29_first-entry.md", - "2019-10-29_second-entry.md", - "2019-10-29_third-entry.md" - ] - """ + """ + [ + "2019-10-29_first-entry.md", + "2019-10-29_second-entry.md", + "2019-10-29_third-entry.md" + ] + """ And the content of file "2019-10-29_third-entry.md" in cache directory "bug768" should be - """ - title: Third entry. - date: 2019-10-29 11:13 - starred: False - tags: + """ + title: Third entry. + date: 2019-10-29 11:13 + starred: False + tags: - """ + """ @deployment_tests Scenario: Version numbers should stay in sync Given we use the config "basic.yaml" When we run "jrnl --version" Then we should get no error - Then the output should contain pyproject.toml version + And the output should contain pyproject.toml version diff --git a/features/starring.feature b/features/starring.feature index 18113dc3..e98976a4 100644 --- a/features/starring.feature +++ b/features/starring.feature @@ -4,17 +4,12 @@ Feature: Starring entries Given we use the config "basic.yaml" When we run "jrnl 20 july 2013 *: Best day of my life!" Then we should see the message "Entry added" - and the journal should contain "[2013-07-20 09:00] Best day of my life! *" + And the journal should contain "[2013-07-20 09:00] Best day of my life! *" Scenario: Filtering by starred entries Given we use the config "basic.yaml" When we run "jrnl -starred" - Then the output should be - """ - """ + Then the output should be empty When we run "jrnl 20 july 2013 *: Best day of my life!" When we run "jrnl -starred" - Then the output should be - """ - 2013-07-20 09:00 Best day of my life! - """ + Then the output should be "2013-07-20 09:00 Best day of my life!" diff --git a/features/steps/core.py b/features/steps/core.py index f82cf8cd..8d1ea3e8 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -270,9 +270,10 @@ def no_error(context): @then("the output should be") +@then("the output should be empty") @then('the output should be "{text}"') def check_output(context, text=None): - text = (text or context.text).strip().splitlines() + text = (text or context.text or "").strip().splitlines() out = context.stdout_capture.getvalue().strip().splitlines() assert len(text) == len(out), "Output has {} lines (expected: {})".format( len(out), len(text) @@ -359,9 +360,11 @@ def journal_doesnt_exist(context, journal_name="default"): assert not os.path.exists(journal_path) +@then('the config should have "{key}" set to') @then('the config should have "{key}" set to "{value}"') @then('the config for journal "{journal}" should have "{key}" set to "{value}"') -def config_var(context, key, value, journal=None): +def config_var(context, key, value="", journal=None): + value = value or context.text or "" if not value[0] == "{": t, value = value.split(":") value = {"bool": lambda v: v.lower() == "true", "int": int, "str": str}[t]( diff --git a/features/tagging.feature b/features/tagging.feature index c96273c5..7a94418f 100644 --- a/features/tagging.feature +++ b/features/tagging.feature @@ -4,7 +4,7 @@ Feature: Tagging Given we use the config "tags.yaml" When we run "jrnl --tags" Then we should get no error - and the output should be + And the output should be """ @idea : 2 @journal : 1 @@ -15,7 +15,7 @@ Feature: Tagging Given we use the config "tags.yaml" When we run "jrnl -from 'may 2013' --tags" Then we should get no error - and the output should be + And the output should be """ @idea : 1 @dan : 1 @@ -25,17 +25,18 @@ Feature: Tagging Given we use the config "tags-216.yaml" When we run "jrnl --tags" Then we should get no error - and the output should be + And the output should be """ @os/2 : 1 @c++ : 1 @c# : 1 """ + Scenario: An email should not be a tag Given we use the config "tags-237.yaml" When we run "jrnl --tags" Then we should get no error - and the output should be + And the output should be """ @newline : 1 @email : 1 @@ -74,10 +75,10 @@ Feature: Tagging Scenario: Excluding multiple tags should filter them Given we use the config "basic.yaml" When we run "jrnl today: I do @not think this will show up @thought" - When we run "jrnl today: I think this will show up @thought" - When we run "jrnl today: This should @never show up @thought" - When we run "jrnl today: What a nice day for filtering @thought" - When we run "jrnl --tags -not @not -not @never" + And we run "jrnl today: I think this will show up @thought" + And we run "jrnl today: This should @never show up @thought" + And we run "jrnl today: What a nice day for filtering @thought" + And we run "jrnl --tags -not @not @never" Then the output should be """ @thought : 2 @@ -88,7 +89,7 @@ Feature: Tagging Given we use the config "multiline-tags.yaml" When we run "jrnl -n 1" Then we should get no error - and the output should be + And the output should be """ 2013-06-09 15:39 Multiple @line entry with @tags. | Tag with @punctuation. afterwards diff --git a/features/upgrade.feature b/features/upgrade.feature index b0a54c16..b8452894 100644 --- a/features/upgrade.feature +++ b/features/upgrade.feature @@ -3,13 +3,15 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x Scenario: Upgrade and parse journals with square brackets Given we use the config "upgrade_from_195.json" When we run "jrnl -9" and enter "Y" - Then the output should contain + Then the journal should have 2 entries + And the output should contain """ 2010-06-10 15:00 A life without chocolate is like a bad analogy. - + """ + And the output should contain + """ 2013-06-10 15:40 He said "[this] is the best time to be alive". """ - Then the journal should have 2 entries Scenario: Upgrading a journal encrypted with jrnl 1.x Given we use the config "encrypted_old.json" @@ -20,23 +22,33 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x bad doggie no biscuit """ 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: Upgrading a config without colors to colors Given we use the config "no_colors.yaml" When we run "jrnl -n 1" - Then the config should have "colors" set to "{'date':'none', 'title':'none', 'body':'none', 'tags':'none'}" + Then the config should have "colors" set to + """ + { + 'date':'none', + 'title':'none', + 'body':'none', + 'tags':'none' + } + """ Scenario: Upgrade and parse journals with little endian date format Given we use the config "upgrade_from_195_little_endian_dates.json" When we run "jrnl -9" and enter "Y" - Then the output should contain + Then the journal should have 2 entries + And the output should contain """ 10.06.2010 15:00 A life without chocolate is like a bad analogy. - + """ + And the output should contain + """ 10.06.2013 15:40 He said "[this] is the best time to be alive". """ - Then the journal should have 2 entries Scenario: Upgrade with missing journal Given we use the config "upgrade_from_195_with_missing_journal.json"