func SubTestDocumentManager_Remove(id bson.ObjectId, dm mongo.DocumentManager, t *testing.T) { user := new(User) err := dm.FindID(id, user) test.Fatal(t, err, nil) test.Fatal(t, len(user.Posts), 1) postID := user.Posts[0].ID roleID := user.Role.ID dm.Remove(user) dm.Flush() err = dm.FindID(id, user) test.Fatal(t, err, mgo.ErrNotFound) post := new(Post) err = dm.FindID(postID, post) test.Fatal(t, err, mgo.ErrNotFound) role := new(Role) err = dm.FindID(roleID, role) test.Fatal(t, err, nil) }
func SubTestDocumentManager_FindID(id bson.ObjectId, dm mongo.DocumentManager, t *testing.T) { user := new(User) err := dm.FindID(id, user) test.Fatal(t, err, nil) test.Fatal(t, user.ID, id) }