From fdc31798fceb6adb24d5bf56bc67ef83424051ee Mon Sep 17 00:00:00 2001 From: Jonathan van der Steege Date: Tue, 14 Jun 2022 19:55:35 +0200 Subject: [PATCH] Corrected BDD tests --- jrnl/config.py | 4 +++- tests/bdd/features/config_file.feature | 18 +++++++++++++++--- .../{double_keys.yaml => duplicate_keys.yaml} | 0 3 files changed, 18 insertions(+), 4 deletions(-) rename tests/data/configs/{double_keys.yaml => duplicate_keys.yaml} (100%) diff --git a/jrnl/config.py b/jrnl/config.py index 3f5e16e9..2ef66332 100644 --- a/jrnl/config.py +++ b/jrnl/config.py @@ -164,7 +164,9 @@ def load_config(config_path): if duplicate_keys: print_msg( Message( - MsgText.ConfigDoubleKeys, MsgStyle.WARNING, {"duplicate_keys": duplicate_keys} + MsgText.ConfigDoubleKeys, + MsgStyle.WARNING, + {"duplicate_keys": duplicate_keys}, ) ) diff --git a/tests/bdd/features/config_file.feature b/tests/bdd/features/config_file.feature index c943811d..d32d800c 100644 --- a/tests/bdd/features/config_file.feature +++ b/tests/bdd/features/config_file.feature @@ -104,7 +104,19 @@ Feature: Multiple journals When we run "jrnl --cf empty_file.yaml" Then the error output should contain "Unable to parse config file" - Scenario: Show a warning message when the config file contains double keys at the same level - Given we use the config "double_keys.yaml" + Scenario: Show a warning message when the config file contains duplicate keys at the same level + Given the config "duplicate_keys.yaml" exists + And we use the config "duplicate_keys.yaml" When we run "jrnl -1" - Then the output should contain "One or more keys appear multiple times at the same level" \ No newline at end of file + Then the output should contain "One or more keys appear multiple times at the same level" + + Scenario: Show a warning message when using --config-file with duplicate keys + Given the config "duplicate_keys.yaml" exists + And we use the config "multiple.yaml" + When we run "jrnl --cf duplicate_keys.yaml -1" + Then the output should contain "One or more keys appear multiple times at the same level" + + Scenario: Don't show a duplicate keys warning message when using --config-override on an existing value + Given we use the config "multiple.yaml" + When we run "jrnl --config-override highlight false" + Then the output should not contain "One or more keys appear multiple times at the same level" \ No newline at end of file diff --git a/tests/data/configs/double_keys.yaml b/tests/data/configs/duplicate_keys.yaml similarity index 100% rename from tests/data/configs/double_keys.yaml rename to tests/data/configs/duplicate_keys.yaml