Check for duplicate keys in config file (#1511)

* Check for duplicate keys in config file
* Corrected BDD tests
* Unneeded check removed
* Make use of ruamel DuplicateKeyError exception
* Remove unneeded import and function
* slightly reword warning message
* fix merge conflicts
* update tests

Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
This commit is contained in:
Jonathan van der Steege 2022-07-16 23:21:21 +02:00 committed by GitHub
parent c45bed7f6c
commit 3a5316cedc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 4 deletions

View file

@ -106,3 +106,20 @@ Feature: Multiple journals
And we use the config "basic_onefile.yaml"
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 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 "There is at least one duplicate key in your configuration file"
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 "There is at least one duplicate key in your configuration file"
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 "There is at least one duplicate key in your configuration file"