-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathclient_authenticate_test.go
More file actions
51 lines (42 loc) · 920 Bytes
/
client_authenticate_test.go
File metadata and controls
51 lines (42 loc) · 920 Bytes
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
51
package gomo
import (
"log"
"os"
"testing"
)
func TestClientAuthenticatesWithClientCredentials(t *testing.T) {
clientID := os.Getenv("CLIENT_ID")
clientSecret := os.Getenv("CLIENT_SECRET")
if clientID == "" {
log.Println("No client id, skipping test")
return
}
if clientSecret == "" {
log.Println("No client secret, skipping test")
return
}
client := NewClient(
NewClientCredentials(
clientID,
clientSecret,
),
)
if err := client.Authenticate(); err != nil {
t.Errorf("Could not authenticate with client credentials: %s", err)
}
}
func TestClientAuthenticatesImplicitly(t *testing.T) {
clientID := os.Getenv("CLIENT_ID")
if clientID == "" {
log.Println("No client id, skipping test")
return
}
client := NewClient(
NewImplicitCredentials(
clientID,
),
)
if err := client.Authenticate(); err != nil {
t.Errorf("Could not authenticate implicitly: %s", err)
}
}