From 62b955e331af8a0d72378df457a0881ec506c69a Mon Sep 17 00:00:00 2001 From: jcobhams Date: Tue, 4 Aug 2020 15:43:48 -0400 Subject: [PATCH] Use secretkey in test mode --- base.go | 2 ++ monify_test.go | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/base.go b/base.go index 057f648..3e0009b 100644 --- a/base.go +++ b/base.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "github.com/jcobhams/gomonnify/testhelpers" "io" "io/ioutil" "net/http" @@ -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") } diff --git a/monify_test.go b/monify_test.go index 796bb26..f5cfc93 100644 --- a/monify_test.go +++ b/monify_test.go @@ -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)) }