-
Notifications
You must be signed in to change notification settings - Fork 0
/
currencies_test.go
57 lines (48 loc) · 1.38 KB
/
currencies_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 igcclient
/*
func TestCurrenciesService_Currencies(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/currencies", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
w.Write([]byte("{\"Data\":[{\"CurrencyId\":1},{\"CurrencyId\":2}],\"Success\":true,\"Errors\":[]}"))
})
countries, err := client.Currencies.Currencies()
if err != nil {
t.Errorf(err.Error())
}
if len(*countries.Data) != 2 {
t.Errorf("Expected 2 currencies")
}
}
func TestCurrenciesService_CurrencyByID(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/currencies/1", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
w.Write([]byte("{\"Data\":{\"CurrencyId\":1},\"Success\":true,\"Errors\":[]}"))
})
country, err := client.Currencies.CurrencyByID(1)
if err != nil {
t.Errorf(err.Error())
}
if *country.Data.CurrencyID != 1 {
t.Errorf("CurrencyID is not 1")
}
}
func TestCurrenciesService_CurrencyByCode(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/currencies/en", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
w.Write([]byte("{\"Data\":{\"CurrencyId\":1},\"Success\":true,\"Errors\":[]}"))
})
country, err := client.Currencies.CurrencyByCode("en")
if err != nil {
t.Errorf(err.Error())
}
if *country.Data.CurrencyID != 1 {
t.Errorf("CurrencyID is not 1")
}
}
*/