-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbanking_test.go
67 lines (56 loc) · 1.44 KB
/
banking_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
58
59
60
61
62
63
64
65
66
67
package banking
import (
"testing"
"time"
"github.com/binzume/gobanking/common"
"github.com/binzume/gobanking/mizuho"
"github.com/binzume/gobanking/rakuten"
"github.com/binzume/gobanking/sbi"
"github.com/binzume/gobanking/shinsei"
"github.com/binzume/gobanking/stub"
"github.com/binzume/gobanking/utils"
)
func TestAccount(t *testing.T) {
// dummy
var _ common.Account = &mizuho.Account{}
var _ common.Account = &rakuten.Account{}
var _ common.Account = &sbi.Account{}
var _ common.Account = &shinsei.Account{}
var _ common.Account = &stub.Account{}
utils.Debug = true
acc, err := LoginWithJsonFile("examples/accounts/stub.json")
if err != nil {
t.Errorf("login failed %v", err)
}
t.Log("Account Info: ", acc.AccountInfo())
lastLogin, err := acc.LastLogin()
if err != nil {
t.Errorf("failed to get last login: %v", err)
}
t.Log("Last login:", lastLogin)
balance, err := acc.TotalBalance()
if err != nil {
t.Errorf("failed to get balabce: %v", err)
}
t.Log("Balance:", balance)
t.Log("Recent: ")
trs, err := acc.Recent()
if err != nil {
t.Errorf("failed to get recent activities: %v", err)
}
for _, tr := range trs {
t.Log(" ", tr)
}
t.Log("History: ")
trs, err = acc.History(time.Now().AddDate(0, 0, -14), time.Now())
if err != nil {
t.Errorf("failed to get history: %v", err)
}
for _, tr := range trs {
t.Log(" ", tr)
}
err = acc.Logout()
if err != nil {
t.Errorf("failed to logout: %v", err)
}
}