forked from yyoshiki41/go-pushwoosh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_test.go
More file actions
36 lines (30 loc) · 757 Bytes
/
client_test.go
File metadata and controls
36 lines (30 loc) · 757 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
package pushwoosh
import (
"net/http"
"testing"
)
func TestNewClient(t *testing.T) {
c := Config{
Endpoint: "https://cp.pushwoosh.com/json",
ApplicationCode: "test-application-code",
AccessToken: "test-access-token",
}
_, err := NewClient(&c)
if err != nil {
t.Fatalf("Failed to construct client: %s", err)
}
}
func TestNewClient_EmptyHTTPClient(t *testing.T) {
var emptyClient *http.Client
SetHTTPClient(emptyClient)
defer teardownHTTPClient()
c := Config{
Endpoint: "https://cp.pushwoosh.com/json",
ApplicationCode: "test-application-code",
AccessToken: "test-access-token",
}
client, err := NewClient(&c)
if err == nil {
t.Errorf("Should detect that HTTPClient is nil.\nclient: %v", client)
}
}