-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_test.go
43 lines (35 loc) · 854 Bytes
/
init_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
43
package gocardless_test
import (
"github.com/cksidharthan/go-gocardless"
"log"
"os"
"testing"
)
var (
testClient *gocardless.Client
testAccountID = "9bd3dd49-be83-4e7c-8893-bf4c68de410b"
)
func TestMain(m *testing.M) {
var err error
gocardlessSecretID := os.Getenv("GOCARDLESS_SECRET_ID")
if gocardlessSecretID == "" {
log.Fatal("GOCARDLESS_SECRET is not set")
}
gocardlessSecretKey := os.Getenv("GOCARDLESS_SECRET_KEY")
if gocardlessSecretKey == "" {
log.Fatal("GOCARDLESS_SECRET_KEY is not set")
}
testClient, err = gocardless.New(&gocardless.Config{
BaseURL: gocardless.BaseURL,
APIVersion: gocardless.APIVersion,
SecretID: gocardlessSecretID,
SecretKey: gocardlessSecretKey,
})
if err != nil {
log.Fatalf("failed to create client: %v\n", err)
}
// Run tests
code := m.Run()
// Exit
os.Exit(code)
}