1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-03 12:48:38 -04:00

testing: Test for and protect against circular accounts

This commit is contained in:
2017-10-12 21:20:13 -04:00
parent d5f8d57bf2
commit c26ce83aa3
2 changed files with 50 additions and 7 deletions

View File

@ -128,7 +128,15 @@ func TestUpdateAccount(t *testing.T) {
t.Fatalf("Expected error updating account with invalid parent: %+v\n", a)
}
// TODO ensure you can't create cycles with ParentAccountId
orig = data[0].accounts[0]
curr = d.accounts[0]
child := d.accounts[1]
curr.ParentAccountId = child.AccountId
a, err = updateAccount(d.clients[orig.UserId], &curr)
if err == nil {
t.Fatalf("Expected error updating account with circular parent relationship: %+v\n", a)
}
})
}