-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpayment_profile_test.go
More file actions
47 lines (44 loc) · 1.09 KB
/
payment_profile_test.go
File metadata and controls
47 lines (44 loc) · 1.09 KB
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
package picnic
import (
"net/http"
"testing"
)
func TestClient_GetPaymentProfile(t *testing.T) {
c, s := testClientFile(http.StatusOK, "test/payment_profile_data.json")
defer s.Close()
res, err := c.GetPaymentProfile()
if err != nil {
t.Fatal(err)
}
if len(res.StoredPaymentOptions) != 5 {
t.Error("Invalid Payment Options")
}
if res.StoredPaymentOptions[0].Brand != "BrandName" {
t.Error("Invalid Payment Options brand")
}
if len(res.AvailablePaymentMethods) != 2 {
t.Error("Invalid Payment Methods")
}
if len(res.AvailablePaymentMethods) != 2 {
t.Error("Invalid Available Payment Options")
}
if len(res.PaymentMethods) != 2 {
t.Error("Invalid Payment methods")
}
if res.PreferredPaymentOptionId != "de1f471e-a461-4dc2-a2fc-a618ddc9b6c4" {
t.Error("Invalid preferred payment")
}
}
func TestClient_GetPaymentProfile_RequiresAuth(t *testing.T) {
c := &Client{
http: http.DefaultClient,
token: "",
}
res, err := c.GetPaymentProfile()
if res != nil {
t.Error("Unexpected response")
}
if err.Error() != authenticationError().Error() {
t.Error("Incorrect error")
}
}