forked from belong-inc/go-hubspot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options_test.go
35 lines (30 loc) · 1.04 KB
/
options_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
package hubspot_test
import (
"net/http"
"net/url"
"testing"
"time"
"github.com/belong-inc/go-hubspot"
"github.com/google/go-cmp/cmp"
)
func TestWithAPIVersion(t *testing.T) {
want := "v0"
c, _ := hubspot.NewClient(hubspot.SetPrivateAppToken("token"), hubspot.WithAPIVersion(want))
if want != c.ExportGetAPIVersion() {
t.Errorf("WithAPIVersion() result mismatch: want %s got %s", want, c.ExportGetAPIVersion())
}
}
func TestWithHTTPClient(t *testing.T) {
want := &http.Client{Timeout: 10 * time.Second}
c, _ := hubspot.NewClient(hubspot.SetPrivateAppToken("token"), hubspot.WithHTTPClient(want))
if diff := cmp.Diff(want, c.HTTPClient); diff != "" {
t.Errorf("WithHTTPClient() result mismatch: (-want +got):%s", diff)
}
}
func TestWithBaseURL(t *testing.T) {
want := &url.URL{Scheme: "http", Host: "example.com"}
c, _ := hubspot.NewClient(hubspot.SetPrivateAppToken("token"), hubspot.WithBaseURL(want))
if diff := cmp.Diff(want, c.ExportGetBaseURL()); diff != "" {
t.Errorf("WithBaseURL() result mismatch: (-want +got):%s", diff)
}
}