mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-06-13 05:29:24 -04:00
testing: Improve testing CRUD for reports
Ensure we don't get silent errors if the Lua code is longer than the database column, don't leave out the first report from testing, test fetching multiple reports.
This commit is contained in:
@ -13,6 +13,8 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
const luaMaxLengthBuffer int = 4096
|
||||
|
||||
func GetDbMap(db *sql.DB, dbtype config.DbType) (*gorp.DbMap, error) {
|
||||
var dialect gorp.Dialect
|
||||
if dbtype == config.SQLite {
|
||||
@ -36,7 +38,8 @@ func GetDbMap(db *sql.DB, dbtype config.DbType) (*gorp.DbMap, error) {
|
||||
dbmap.AddTableWithName(handlers.Transaction{}, "transactions").SetKeys(true, "TransactionId")
|
||||
dbmap.AddTableWithName(handlers.Split{}, "splits").SetKeys(true, "SplitId")
|
||||
dbmap.AddTableWithName(handlers.Price{}, "prices").SetKeys(true, "PriceId")
|
||||
dbmap.AddTableWithName(handlers.Report{}, "reports").SetKeys(true, "ReportId")
|
||||
rtable := dbmap.AddTableWithName(handlers.Report{}, "reports").SetKeys(true, "ReportId")
|
||||
rtable.ColMap("Lua").SetMaxSize(handlers.LuaMaxLength + luaMaxLengthBuffer)
|
||||
|
||||
err := dbmap.CreateTablesIfNotExists()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user