-
Notifications
You must be signed in to change notification settings - Fork 1
/
account_test.go
57 lines (49 loc) · 1.15 KB
/
account_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
51
52
53
54
55
56
57
package vscale
import (
"fmt"
"net/http"
"reflect"
"testing"
)
func TestAccountGet(t *testing.T) {
setup()
defer teardown()
mux.HandleFunc("/v1/account", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
response := `
{
"info": {
"actdate": "2015-07-07 08:16:47.107987",
"country": "",
"email": "[email protected]",
"face_id": "1",
"id": "1001",
"locale": "ru",
"middlename": "MiddleName",
"mobile": "+79901234567",
"name": "UserName",
"state": "1",
"surname": "SurName"
}
}`
fmt.Fprint(w, response)
})
acct, _, err := client.Account.Get()
if err != nil {
t.Errorf("Account.Get returned error: %v", err)
}
expected := &Account{
ActivateDate: "2015-07-07 08:16:47.107987",
Country: "",
FaceID: 1,
ID: 1001,
State: 1,
Email: "[email protected]",
Name: "UserName",
MiddleName: "MiddleName",
SurName: "SurName",
}
if !reflect.DeepEqual(acct, expected) {
t.Errorf("Account.Get returned %+v, expected %+v", acct, expected)
}
}