Skip to content

Commit

Permalink
Add tests for blank eyaml values
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert A. Vincent II (Bob-Vee) committed Jul 29, 2021
1 parent 75b0e20 commit ddf559f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 13 additions & 1 deletion features/edit.feature
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,19 @@ Feature: eyaml editing
When I run `eyaml edit non-existant-file.eyaml`
When I run `eyaml decrypt -e non-existant-file.eyaml`
Then the output should not match /#| This is eyaml edit mode/
And the output should match /new_key0: DEC::PKCS7\[\]\!/
And the output should match /new_key1: DEC::PKCS7\[new value one\]\!/
And the output should match /new_key2: DEC::PKCS7\[new value two\]\!/

Scenario: eyaml should support blank values
Given my EDITOR is set to "./append.sh test_blank_values.yaml"
When I run `bash -c 'rm non-existant-file.eyaml'`
When I run `eyaml edit non-existant-file.eyaml`
When I run `eyaml decrypt -e non-existant-file.eyaml`
Then the output should not match /#| This is eyaml edit mode/
And the output should match /new_key1: DEC::PKCS7\[\]\!/
And the output should match /new_key2: DEC::PKCS7\[new value two\]\!/

Scenario: decrypt and reencrypt an eyaml file
Given my EDITOR is set to "./convert_decrypted_values_to_uppercase.sh"
When I run `bash -c 'cp test_input.yaml test_input.eyaml'`
Expand Down Expand Up @@ -99,6 +109,7 @@ Feature: eyaml editing
When I run `eyaml edit test_input.eyaml`
When I run `eyaml decrypt -e test_input.eyaml`
Then the output should match /encrypted_string: DEC::PKCS7\[planet of the apes\]\!/
And the output should match /new_key0: DEC::PKCS7\[\]\!/
And the output should match /new_key1: DEC::PKCS7\[new value one\]\!/
And the output should match /new_key2: DEC::PKCS7\[new value two\]\!/
And the output should match /multi_encryption: DEC::PLAINTEXT\[jammy\]\! DEC::PKCS7\[dodger\]!/
Expand Down Expand Up @@ -146,7 +157,8 @@ Feature: eyaml editing
When I run `bash -c 'cp test_edit.yaml test_edit.eyaml'`
When I run `eyaml edit -d test_edit.eyaml`
When I run `eyaml decrypt -e test_edit.eyaml`
Then the output should match /new_key1: DEC::PKCS7\[new value one\]\!/
Then the output should match /new_key0: DEC::PKCS7\[\]\!/
And the output should match /new_key1: DEC::PKCS7\[new value one\]\!/
And the output should match /new_key2: DEC::PKCS7\[new value two\]\!/

Scenario: no-decrypt mode should not modify existing values
Expand Down
3 changes: 2 additions & 1 deletion features/sandbox/test_new_values.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
new_key0: DEC::PKCS7[]!
new_key1: DEC::PKCS7[new value one]!
new_key2: DEC::PKCS7[new value two]!
new_key2: DEC::PKCS7[new value two]!

0 comments on commit ddf559f

Please sign in to comment.