()
| 309 | } |
| 310 | |
| 311 | func (s *UserSuite) Test_CreateUser_NameAlreadyExists() { |
| 312 | s.loginAdmin() |
| 313 | s.db.NewUserWithName(2, "tom") |
| 314 | |
| 315 | s.ctx.Request = httptest.NewRequest("POST", "/user", strings.NewReader(`{"name": "tom", "pass": "mylittlepony", "admin": true}`)) |
| 316 | s.ctx.Request.Header.Set("Content-Type", "application/json") |
| 317 | |
| 318 | s.a.CreateUser(s.ctx) |
| 319 | |
| 320 | assert.Equal(s.T(), 400, s.recorder.Code) |
| 321 | } |
| 322 | |
| 323 | func (s *UserSuite) Test_UpdateUserByID_InvalidID() { |
| 324 | s.ctx.Params = gin.Params{{Key: "id", Value: "abc"}} |
nothing calls this directly
no test coverage detected