-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_test.go
42 lines (35 loc) · 915 Bytes
/
client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package gocardless_test
import (
"fmt"
"os"
"testing"
gocardless "github.com/cksidharthan/go-gocardless"
)
func getTestClient(t *testing.T) (*gocardless.Client, error) {
t.Helper()
secretID := os.Getenv("GOCARDLESS_SECRET_ID")
secretKey := os.Getenv("GOCARDLESS_SECRET_KEY")
if secretID == "" || secretKey == "" {
fmt.Println("GOCARDLESS_SECRET_ID or GOCARDLESS_SECRET_KEY is not set")
}
return gocardless.New(
&gocardless.Config{
BaseURL: gocardless.BaseURL,
APIVersion: gocardless.APIVersion,
SecretID: secretID,
SecretKey: secretKey,
},
)
}
func getInvalidTestClient(t *testing.T) (*gocardless.Client, error) {
t.Helper()
return &gocardless.Client{
HTTP: gocardless.NewHTTPClient(gocardless.BaseURL, gocardless.APIVersion),
SecretID: "invalid",
SecretKey: "invalid",
Token: &gocardless.Token{
Access: "invalid",
Refresh: "invalid",
},
}, nil
}