1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-07 02:00:20 +00:00

Merge pull request #1874 from Maxgis/master

change limit 1000 to 1,reduce the amount the data
This commit is contained in:
astaxie
2016-04-26 09:56:44 +08:00
2 changed files with 13 additions and 4 deletions

View File

@ -993,12 +993,19 @@ func TestOne(t *testing.T) {
var user User
qs := dORM.QueryTable("user")
err := qs.One(&user)
throwFail(t, AssertIs(err, ErrMultiRows))
throwFail(t, err)
user = User{}
err = qs.OrderBy("Id").Limit(1).One(&user)
throwFailNow(t, err)
throwFail(t, AssertIs(user.UserName, "slene"))
throwFail(t, AssertNot(err, ErrMultiRows))
user = User{}
err = qs.OrderBy("-Id").Limit(100).One(&user)
throwFailNow(t, err)
throwFail(t, AssertIs(user.UserName, "nobody"))
throwFail(t, AssertNot(err, ErrMultiRows))
err = qs.Filter("user_name", "nothing").One(&user)
throwFail(t, AssertIs(err, ErrNoRows))