예제 #1
0
파일: user_test.go 프로젝트: reoring/tsuru
func (s *S) TestDeleteUser(c *check.C) {
	u := User{Email: "*****@*****.**", Password: "******"}
	err := u.Create()
	c.Assert(err, check.IsNil)
	err = u.Delete()
	c.Assert(err, check.IsNil)
	user, err := GetUserByEmail(u.Email)
	c.Assert(err, check.Equals, ErrUserNotFound)
	c.Assert(user, check.IsNil)
	c.Assert(repositorytest.Users(), check.HasLen, 0)
}
예제 #2
0
func (s *S) TestOAuthCreate(c *check.C) {
	scheme := OAuthScheme{}
	user := auth.User{Email: "*****@*****.**", Password: "******"}
	_, err := scheme.Create(&user)
	c.Assert(err, check.IsNil)
	dbUser, err := auth.GetUserByEmail(user.Email)
	c.Assert(err, check.IsNil)
	c.Assert(dbUser.Email, check.Equals, user.Email)
	c.Assert(dbUser.Password, check.Equals, "")
	c.Assert(repositorytest.Users(), check.DeepEquals, []string{user.Email})
}
예제 #3
0
파일: user_test.go 프로젝트: reoring/tsuru
func (s *S) TestCreateUser(c *check.C) {
	u := User{Email: "*****@*****.**", Password: "******"}
	err := u.Create()
	c.Assert(err, check.IsNil)
	defer u.Delete()
	var result User
	collection := s.conn.Users()
	err = collection.Find(bson.M{"email": u.Email}).One(&result)
	c.Assert(err, check.IsNil)
	c.Assert(result.Email, check.Equals, u.Email)
	c.Assert(repositorytest.Users(), check.DeepEquals, []string{u.Email})
}