From e64ca2d5b7dd3a3b49d9bdb82b68df1245503505 Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Sun, 16 May 2021 21:14:45 -0600 Subject: [PATCH] [Test] behave tests pass locally --- features/format.feature | 3 +++ features/plugins.feature | 20 ++++++++++++++++++++ features/steps/export_steps.py | 10 ++++++++++ features/write.feature | 2 ++ 4 files changed, 35 insertions(+) diff --git a/features/format.feature b/features/format.feature index fd1616f7..e369d7b3 100644 --- a/features/format.feature +++ b/features/format.feature @@ -26,6 +26,7 @@ Feature: Custom formats | basic_folder | | basic_dayone | + @skip_no_external_plugins Scenario Outline: JSON format Given we use the config ".yaml" And we use the password "test" if prompted @@ -48,6 +49,7 @@ Feature: Custom formats | basic_folder | | basic_dayone | + @skip_no_external_plugins Scenario: Exporting dayone to json Given we use the config "dayone.yaml" When we run "jrnl --export json" @@ -91,6 +93,7 @@ Feature: Custom formats | basic_folder | | basic_dayone | + @skip_no_external_plugins Scenario Outline: Exporting using filters should only export parts of the journal Given we use the config ".yaml" And we use the password "test" if prompted diff --git a/features/plugins.feature b/features/plugins.feature index 0c95626f..8b86328b 100644 --- a/features/plugins.feature +++ b/features/plugins.feature @@ -64,3 +64,23 @@ Feature: Functionality of Importer and Exporter Plugins | plugin_name | version | source | type | filename | | json | | plugins | exporter | json | | txt | | plugins | exporter | text | + + + @skip_only_with_external_plugins + Scenario Outline: JSON format + Given we use the config ".yaml" + And we use the password "test" if prompted + When we run "jrnl --format json" + Then we should get no error + And the output should be parsable as json + And "entries" in the json output should have 3 elements + And entry 1 should not have an array "tags" + And entry 2 should not have an array "tags" + And entry 3 should not have an array "tags" + + Examples: configs + | config | + | basic_onefile | + | basic_encrypted | + | basic_folder | + | basic_dayone | diff --git a/features/steps/export_steps.py b/features/steps/export_steps.py index 8141dc36..ffc54671 100644 --- a/features/steps/export_steps.py +++ b/features/steps/export_steps.py @@ -89,6 +89,16 @@ def entry_array_count(context, entry_number, name, items_number): assert len(out_json["entries"][entry_number - 1][name]) == items_number +@then( + 'entry {entry_number:d} should not have an array "{name}"' +) +def entry_not_array_item(context, entry_number, name): + # note that entry_number is 1-indexed. + out = context.stdout_capture.getvalue() + out_json = json.loads(out) + assert (name not in out_json["entries"][entry_number - 1]) + + @then("the output should be a valid XML string") def assert_valid_xml_string(context): output = context.stdout_capture.getvalue() diff --git a/features/write.feature b/features/write.feature index eb22e480..08766a4d 100644 --- a/features/write.feature +++ b/features/write.feature @@ -183,6 +183,8 @@ Feature: Writing new entries. And we run "jrnl -until 1980" Then the output should be "1979-05-01 09:00 Being born hurts." + # the testing plugins override the JSON exporter + @skip_no_external_plugins Scenario: Writing into Dayone adds extended metadata Given we use the config "dayone.yaml" When we run "jrnl 01 may 1979: Being born hurts."