mirror of
				https://github.com/aclindsa/moneygo.git
				synced 2025-11-03 18:13:27 -05:00 
			
		
		
		
	testing: Add more data
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -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",
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user