-
Notifications
You must be signed in to change notification settings - Fork 0
/
buyer_test.go
55 lines (43 loc) · 1.05 KB
/
buyer_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
package zoop
import (
"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/assert"
"testing"
)
func TestAddBuyer(t *testing.T) {
params := &BuyerParams{
FirstName: "John",
LastName: "Doe",
Email: "[email protected]",
TaxpayerId: "00000000000",
}
buyer, err := client.NewBuyer(params)
assert.NoError(t, err)
assert.NotEmpty(t, buyer.Id)
assert.Equal(t, buyer.Email, params.Email)
}
func TestGetBuyer(t *testing.T) {
buyer, err := client.GetBuyer("")
assert.NoError(t, err)
assert.Equal(t, buyer.Id, "")
}
func TestSetBuyer(t *testing.T) {
params := &BuyerParams{
PhoneNumber: "999999999",
}
buyer, err := client.SetBuyer("", params)
assert.NoError(t, err)
assert.Equal(t, buyer.Id, "")
assert.Equal(t, buyer.PhoneNumber, params.PhoneNumber)
}
func TestListBuyers(t *testing.T) {
list, err := client.ListBuyer()
assert.NoError(t, err)
assert.NotZero(t, len(list.Buyers))
spew.Dump(list)
}
func TestDelBuyer(t *testing.T) {
del, err := client.DelBuyer("")
assert.NoError(t, err)
assert.Equal(t, "", del.Id)
}