1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-12-26 07:33:21 -05:00

testing: Add more data

This commit is contained in:
Aaron Lindsay 2017-10-23 20:10:00 -04:00
parent 2246a4bff9
commit 9b00bc8db1
2 changed files with 49 additions and 1 deletions

View File

@ -138,7 +138,12 @@ func TestUpdateAccount(t *testing.T) {
curr.Name = "blah"
curr.Type = handlers.Payable
curr.SecurityId = d.securities[1].SecurityId
for _, s := range d.securities {
if s.UserId == curr.UserId {
curr.SecurityId = s.SecurityId
break
}
}
a, err := updateAccount(d.clients[orig.UserId], &curr)
if err != nil {

View File

@ -61,6 +61,7 @@ func (t *TestData) initUser(user *User, userid int) error {
if err != nil {
return err
}
t.clients = append(t.clients, client)
// TODO initialize everything else owned by this user in the TestData struct
@ -170,6 +171,15 @@ var data = []TestData{
Type: handlers.Stock,
AlternateId: "78462F103",
},
handlers.Security{
UserId: 1,
Name: "EUR",
Description: "Euro",
Symbol: "€",
Precision: 2,
Type: handlers.Currency,
AlternateId: "978",
},
},
accounts: []handlers.Account{
handlers.Account{
@ -207,6 +217,20 @@ var data = []TestData{
Type: handlers.Expense,
Name: "Cable",
},
handlers.Account{
UserId: 1,
SecurityId: 2,
ParentAccountId: -1,
Type: handlers.Asset,
Name: "Assets",
},
handlers.Account{
UserId: 1,
SecurityId: 2,
ParentAccountId: -1,
Type: handlers.Expense,
Name: "Expenses",
},
},
transactions: []handlers.Transaction{
handlers.Transaction{
@ -247,6 +271,25 @@ var data = []TestData{
},
},
},
handlers.Transaction{
UserId: 1,
Description: "Gas",
Date: time.Date(2017, time.November, 1, 13, 19, 50, 0, time.UTC),
Splits: []*handlers.Split{
&handlers.Split{
Status: handlers.Reconciled,
AccountId: 5,
SecurityId: -1,
Amount: "-24.56",
},
&handlers.Split{
Status: handlers.Entered,
AccountId: 6,
SecurityId: -1,
Amount: "24.56",
},
},
},
},
},
}