-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_test.go
50 lines (41 loc) · 900 Bytes
/
setup_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
44
45
46
47
48
49
50
package toast_test
import (
"log"
"net/url"
"os"
"testing"
asperion "github.com/omniboost/go-toast"
)
var (
client *asperion.Client
)
func TestMain(m *testing.M) {
var err error
baseURLString := os.Getenv("BASE_URL")
clientID := os.Getenv("CLIENT_ID")
clientSecret := os.Getenv("CLIENT_SECRET")
toastRestaurantExternalID := os.Getenv("TOAST_RESTAURANT_EXTERNAL_ID")
debug := os.Getenv("DEBUG")
if err != nil {
log.Fatal(err)
}
var baseURL *url.URL
if baseURLString != "" {
baseURL, err = url.Parse(baseURLString)
if err != nil {
log.Fatal(err)
}
}
client = asperion.NewClient(nil)
client.SetClientID(clientID)
client.SetClientSecret(clientSecret)
client.SetToastRestaurantExternalID(toastRestaurantExternalID)
if debug != "" {
client.SetDebug(true)
}
if baseURL != nil {
client.SetBaseURL(*baseURL)
}
client.SetDisallowUnknownFields(true)
m.Run()
}