1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-26 17:41:28 +00:00

fix the ORM test case

This commit is contained in:
astaxie 2016-01-15 14:36:45 +08:00
parent a069c73b3a
commit 797571c85f
2 changed files with 2 additions and 4 deletions

View File

@ -335,7 +335,7 @@ func NewComment() *Comment {
} }
type Group struct { type Group struct {
GID string `orm:"pk;column(gid);size(32);unique"` ID int `orm:"column(gid);size(32)"`
Name string Name string
Permissions []*Permission `orm:"reverse(many)" json:"-"` Permissions []*Permission `orm:"reverse(many)" json:"-"`
} }

View File

@ -663,12 +663,10 @@ The program—and web server—godoc processes Go source files to extract docume
groups := []*Group{ groups := []*Group{
{ {
GID: "g1",
Name: "admins", Name: "admins",
Permissions: []*Permission{permissions[0], permissions[1], permissions[2]}, Permissions: []*Permission{permissions[0], permissions[1], permissions[2]},
}, },
{ {
GID: "g2",
Name: "users", Name: "users",
Permissions: []*Permission{permissions[1], permissions[2]}, Permissions: []*Permission{permissions[1], permissions[2]},
}, },
@ -683,7 +681,7 @@ The program—and web server—godoc processes Go source files to extract docume
for _, group := range groups { for _, group := range groups {
_, err := dORM.Insert(group) _, err := dORM.Insert(group)
throwFail(t, err) throwFail(t, err)
//throwFail(t, AssertIs(id > 0, true)) throwFail(t, AssertIs(id > 0, true))
num := len(group.Permissions) num := len(group.Permissions)
if num > 0 { if num > 0 {