()
| 332 | } |
| 333 | |
| 334 | func (s *UserSuite) Test_UpdateUserByID_LastAdmin_Expect400() { |
| 335 | s.db.CreateUser(&model.User{ |
| 336 | ID: 7, |
| 337 | Name: "admin", |
| 338 | Admin: true, |
| 339 | }) |
| 340 | |
| 341 | s.ctx.Params = gin.Params{{Key: "id", Value: "7"}} |
| 342 | |
| 343 | s.ctx.Request = httptest.NewRequest("POST", "/user/7", strings.NewReader(`{"name": "admin", "pass": "", "admin": false}`)) |
| 344 | s.ctx.Request.Header.Set("Content-Type", "application/json") |
| 345 | s.a.UpdateUserByID(s.ctx) |
| 346 | |
| 347 | assert.Equal(s.T(), 400, s.recorder.Code) |
| 348 | } |
| 349 | |
| 350 | func (s *UserSuite) Test_UpdateUserByID_UnknownUser() { |
| 351 | s.ctx.Params = gin.Params{{Key: "id", Value: "2"}} |
nothing calls this directly
no test coverage detected