1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-02 20:28:38 -04:00

testing: Add account tests

This commit is contained in:
2017-10-11 21:19:14 -04:00
parent 52ee17dae8
commit a399d75124
3 changed files with 182 additions and 2 deletions

View File

@ -528,10 +528,19 @@ func AccountHandler(w http.ResponseWriter, r *http.Request, db *DB) {
return
}
if account.ParentAccountId == account.AccountId {
WriteError(w, 3 /*Invalid Request*/)
return
}
err = UpdateAccount(db, &account)
if err != nil {
WriteError(w, 999 /*Internal Error*/)
log.Print(err)
if _, ok := err.(ParentAccountMissingError); ok {
WriteError(w, 3 /*Invalid Request*/)
} else {
WriteError(w, 999 /*Internal Error*/)
log.Print(err)
}
return
}