Skip to content

Commit

Permalink
delete by user email
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Lin committed Jul 25, 2018
1 parent 65b5128 commit 13cefdb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/handler_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (suite *UserTestSuite) TestCreateUser() {
httpWriter := httptest.NewRecorder()
suite.wc.Dispatch(httpWriter, httpRequest)
assertResponseCode(suite.T(), http.StatusOK, httpWriter)
defer suite.session.Remove(entity.UserCollectionName, "_id", user.ID)
defer suite.session.Remove(entity.UserCollectionName, "email", user.Email)

// load data to check
retUser := entity.User{}
Expand Down Expand Up @@ -173,7 +173,7 @@ func (suite *UserTestSuite) TestGetUser() {
}
// Create data into mongo manually
suite.session.C(entity.UserCollectionName).Insert(user)
defer suite.session.Remove(entity.UserCollectionName, "_id", user.ID)
defer suite.session.Remove(entity.UserCollectionName, "email", user.Email)

httpRequest, err := http.NewRequest("GET", "http://localhost:7890/v1/users/"+user.ID.Hex(), nil)
suite.NoError(err)
Expand Down Expand Up @@ -217,7 +217,7 @@ func (suite *UserTestSuite) TestListUser() {

for _, u := range users {
suite.session.C(entity.UserCollectionName).Insert(u)
defer suite.session.Remove(entity.UserCollectionName, "_id", u.ID)
defer suite.session.Remove(entity.UserCollectionName, "email", u.Email)
}

testCases := []struct {
Expand Down

0 comments on commit 13cefdb

Please sign in to comment.