-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Shopify/prevent-fail-on-no-env
prevents failure due to missing environment
- Loading branch information
Showing
7 changed files
with
105 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
) | ||
|
||
func TestReadKey(t *testing.T) { | ||
buffer := bytes.NewBufferString(TestKeyValue) | ||
value, err := readKey(buffer) | ||
|
||
if nil != err { | ||
t.Errorf("shouldn't have returned an error, return: %s", err) | ||
} | ||
|
||
if value != TestKeyValue { | ||
t.Errorf("value does not match expected:\nvalue: \"%s\"\nexpected: \"%s\"", value, TestKeyValue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestReadSecrets(t *testing.T) { | ||
var err error | ||
|
||
_, err = ReadSecrets("bad.ejson", "./key", TestKeyValue) | ||
if nil == err { | ||
t.Fatal("failed to fail when loading a broken ejson file") | ||
} | ||
if !strings.Contains(err.Error(), "no such file or directory") { | ||
t.Errorf("error should be \"no such file or directory\": %s", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"_public_key": "795e671066eef17025c816b6d7c4f5c658b191cfaa31baca69963d761606415c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"_public_key": "795e671066eef17025c816b6d7c4f5c658b191cfaa31baca69963d761606415c", | ||
"environment": "EJ[1:vLCXRxBXJjdT+w8gSPlM45F3HdykWvUdNAeXLJ51GQ4=:BxQq4GdlfxXvCHs0xall8LKesFVjEStm:K2GhhrTy4Tvhb2w0d3RyR9Y/Gg==]" | ||
} |