Skip to content

Commit

Permalink
Use secretkey in test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jcobhams authored and jcobhams committed Aug 4, 2020
1 parent 032eab2 commit 62b955e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions base.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/jcobhams/gomonnify/testhelpers"
"io"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -34,6 +35,7 @@ func newBase(config Config) *base {
case EnvTest:
if testUrl, ok := os.LookupEnv("GOMONNIFY_TESTURL"); ok {
b.APIBaseUrl = testUrl
b.Config.SecretKey = testhelpers.SecretKey
} else {
panic("gomonnify is running in test mode but no test url provided. Please Set GOMONNIFY_TESTURL env var")
}
Expand Down
5 changes: 1 addition & 4 deletions monify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,9 @@ func TestGeneral_GetTransaction(t *testing.T) {
}

func TestGeneral_VerifyTransaction(t *testing.T) {
tx, _ := client.General.GetTransaction(testhelpers.TransferReference)
assert.False(t, client.General.VerifyTransaction(&tx.ResponseBody, false))

//Set Secret Key To Be Test Environemnt Secret Key
client.General.Config.SecretKey = testhelpers.SecretKey
tx, _ = client.General.GetTransaction(testhelpers.TransferReference)
tx, _ := client.General.GetTransaction(testhelpers.TransferReference)
assert.True(t, client.General.VerifyTransaction(&tx.ResponseBody, false))
assert.True(t, client.General.VerifyTransaction(&tx.ResponseBody, true))
}
Expand Down

0 comments on commit 62b955e

Please sign in to comment.