mirror of
https://github.com/astaxie/beego.git
synced 2024-11-21 22:50:56 +00:00
fix UT
This commit is contained in:
parent
139c393f08
commit
739b8bab0c
@ -2538,7 +2538,7 @@ func TestStrPkInsert(t *testing.T) {
|
|||||||
var err error
|
var err error
|
||||||
_, err = dORM.Insert(strPk)
|
_, err = dORM.Insert(strPk)
|
||||||
throwFailNow(t, AssertIs(err, nil))
|
throwFailNow(t, AssertIs(err, nil))
|
||||||
|
|
||||||
var vForTesting StrPk
|
var vForTesting StrPk
|
||||||
err = dORM.QueryTable(new(StrPk)).Filter(`id`, pk).One(&vForTesting)
|
err = dORM.QueryTable(new(StrPk)).Filter(`id`, pk).One(&vForTesting)
|
||||||
throwFailNow(t, AssertIs(err, nil))
|
throwFailNow(t, AssertIs(err, nil))
|
||||||
@ -2549,12 +2549,19 @@ func TestStrPkInsert(t *testing.T) {
|
|||||||
Id: pk,
|
Id: pk,
|
||||||
Value: value2,
|
Value: value2,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = dORM.InsertOrUpdate(strPkForUpsert, `id`)
|
_, err = dORM.InsertOrUpdate(strPkForUpsert, `id`)
|
||||||
throwFailNow(t, AssertIs(err, nil))
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
var vForTesting2 StrPk
|
if err.Error() == "postgres version must 9.5 or higher" || err.Error() == "`sqlite3` nonsupport InsertOrUpdate in beego" {
|
||||||
err = dORM.QueryTable(new(StrPk)).Filter(`id`, pk).One(&vForTesting2)
|
} else {
|
||||||
throwFailNow(t, AssertIs(err, nil))
|
throwFailNow(t, err)
|
||||||
throwFailNow(t, AssertIs(vForTesting2.Value, value2))
|
}
|
||||||
|
} else {
|
||||||
|
var vForTesting2 StrPk
|
||||||
|
err = dORM.QueryTable(new(StrPk)).Filter(`id`, pk).One(&vForTesting2)
|
||||||
|
throwFailNow(t, AssertIs(err, nil))
|
||||||
|
throwFailNow(t, AssertIs(vForTesting2.Value, value2))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user