From e459cb3bb997e3dbb078ae4d4c5abafcc3566730 Mon Sep 17 00:00:00 2001 From: Stanley Shyiko Date: Sat, 14 Apr 2018 23:49:37 -0700 Subject: [PATCH] Fixed failing tests --- cmd/encrypt_test.go | 6 +++--- cmd/introspect_test.go | 4 ++-- cmd/merge_test.go | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd/encrypt_test.go b/cmd/encrypt_test.go index fb5d075..506cdf6 100644 --- a/cmd/encrypt_test.go +++ b/cmd/encrypt_test.go @@ -34,7 +34,7 @@ func TestEncryptGivenEmptyData(t *testing.T) { } func TestEncrypt(t *testing.T) { - actual, err := EncryptWithContext([]byte(`{"kind": "Secret", "data": {"key": "value"}}`), EncryptionContext{}) + actual, err := EncryptWithContext([]byte(`{"kind": "Secret", "data": {"key": "dmFsdWU="}}`), EncryptionContext{}) if err != nil { t.Fatal(err) } @@ -74,7 +74,7 @@ func TestKeyRotation(t *testing.T) { } func TestEncryptKeyAdd(t *testing.T) { - input := "data:\n key: value\nkind: Secret\n" + input := "data:\n key: dmFsdWU=\nkind: Secret\n" encrypted, err := EncryptWithContext([]byte(input), EncryptionContext{}) if err != nil { t.Fatal(err) @@ -127,7 +127,7 @@ func TestEncryptKeyRemove(t *testing.T) { primaryKey.Fingerprint, "72ECF46A56B4AD39C907BBB71646B01B86E50310", } - encrypted, err := EncryptWithContext([]byte("data:\n key: value\nkind: Secret\n"), EncryptionContext{ + encrypted, err := EncryptWithContext([]byte("data:\n key: dmFsdWU=\nkind: Secret\n"), EncryptionContext{ Keys: Keys{ KeyWithDEK{Key{KTPGP, expected[0]}, nil}, KeyWithDEK{Key{KTPGP, expected[1]}, nil}, diff --git a/cmd/introspect_test.go b/cmd/introspect_test.go index 3da15e5..91cf6a9 100644 --- a/cmd/introspect_test.go +++ b/cmd/introspect_test.go @@ -6,7 +6,7 @@ import ( ) func TestIntrospectUnencrypted(t *testing.T) { - if _, err := Introspect([]byte("data:\n key: value\nkind: Secret\n")); err == nil { + if _, err := Introspect([]byte("data:\n key: dmFsdWU=\nkind: Secret\n")); err == nil { t.Fail() } else { actual := err.Error() @@ -22,7 +22,7 @@ func TestIntrospect(t *testing.T) { "160A7A9CF46221A56B06AD64461A804F2609FD89", "72ECF46A56B4AD39C907BBB71646B01B86E50310", } - encrypted, err := EncryptWithContext([]byte("data:\n key: value\nkind: Secret\n"), EncryptionContext{ + encrypted, err := EncryptWithContext([]byte("data:\n key: dmFsdWU=\nkind: Secret\n"), EncryptionContext{ Keys: Keys{ KeyWithDEK{Key{KTPGP, expected[0]}, nil}, KeyWithDEK{Key{KTPGP, expected[1]}, nil}, diff --git a/cmd/merge_test.go b/cmd/merge_test.go index 4ddbf36..2c56730 100644 --- a/cmd/merge_test.go +++ b/cmd/merge_test.go @@ -56,8 +56,10 @@ data: } func TestMerge(t *testing.T) { - encrypted, err := EncryptWithContext([]byte(`{"kind":"Secret","data":{"KEY":"VALUE","ANOTHER_KEY":"ANOTHER_VALUE"}}`), - EncryptionContext{}) + encrypted, err := EncryptWithContext( + []byte(`{"kind":"Secret","data":{"KEY":"VkFMVUU=","ANOTHER_KEY":"QU5PVEhFUl9WQUxVRQ=="}}`), + EncryptionContext{}, + ) if err != nil { t.Fatal(err) }