-
Notifications
You must be signed in to change notification settings - Fork 0
/
accounts_test.go
46 lines (35 loc) · 976 Bytes
/
accounts_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
package monzo
import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
func TestAccountsList(t *testing.T) {
expected := &AccountsList{
Accounts: []Account{{
ID: "acc_00009237aqC8c5umZmrRdh",
Description: "Peter Pan's Account",
Created: "2015-11-13T12:17:42Z",
}},
}
c := MockRequest(expected, nil)
accs, err := c.Accounts.List()
assert.NoError(t, err)
assert.Equal(t, expected, accs)
}
func TestAccountsListFilter(t *testing.T) {
expected := &AccountsList{
Accounts: []Account{{
ID: "acc_00009237aqC8c5umZmrRdh",
Description: "Peter Pan's Account",
Created: "2015-11-13T12:17:42Z",
}},
}
c := MockRequest(expected, func(args mock.Arguments) {
req := args.Get(0).(*http.Request)
assert.Equal(t, string(AccountTypeUKRetailJoint), req.URL.Query().Get("account_type"))
})
_, err := c.Accounts.List(AccountTypeUKRetailJoint)
assert.NoError(t, err)
}