forked from tnako/appnexus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmember_test.go
42 lines (36 loc) · 926 Bytes
/
member_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
package appnexus
import (
"fmt"
"net/http"
"testing"
)
func TestMemberService_Get(t *testing.T) {
setup()
defer teardown()
mux.HandleFunc("/member/1", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, `{"response":
{"status":"OK",
"count": 1,
"start_element": 0,
"num_elements": 100,
"member": {
"ID": 1,
"Name": "Test Member",
"State": "active",
"default_currency": "GBP"
}}}`)
})
actual, err := client.Members.Get(1)
if err != nil {
t.Errorf("Members.Get returned error: %v", err)
}
expected := Member{
ID: 1,
Name: "Test Member",
State: "active",
DefaultCurrency: "GBP",
}
if actual.ID != expected.ID || actual.Name != expected.Name {
t.Errorf("Members.Get returned %+v, expected %+v", actual, expected)
}
}