Skip to content

Commit

Permalink
inclease more test coverage with covering Encrypt/Decrypt without Set…
Browse files Browse the repository at this point in the history
…CryptKey blaskovicz#6
  • Loading branch information
u5surf committed Sep 20, 2019
1 parent 003ea77 commit 3b9a65a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cryptkeeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ func TestCryptSetup(t *testing.T) {

func TestCryptString(t *testing.T) {

t.Run("Invalid without SetCryptKey", func(t *testing.T) {
t.Run("Invalid Encrypt", func(t *testing.T) {
_, err := Encrypt("abc")
if err == nil {
t.Fatalf("Encrypt without SetCryptKey should have errored: '%s'", err)
}
})
t.Run("Invalid Decrypt", func(t *testing.T) {
_, err := Decrypt("2tHq4GL8r7tTvfk6l2TS8d5nVDXY6ztqz6WTmbmq8ZOJ")
if err == nil {
t.Fatalf("Decrypt without SetCryptKey should have errored: %s", err)
}
})
})
t.Run("Encrypt/Valid", func(t *testing.T) {
err := SetCryptKey([]byte("12345678901234567890123456789012"))
if err != nil {
Expand Down

0 comments on commit 3b9a65a

Please # to comment.