()
| 198 | } |
| 199 | |
| 200 | func (s *UserSuite) Test_CreateUser_Register_ByNonAdmin() { |
| 201 | s.loginUser() |
| 202 | s.a.Registration = true |
| 203 | |
| 204 | s.ctx.Request = httptest.NewRequest("POST", "/user", strings.NewReader(`{"name": "tom", "pass": "1", "admin": false}`)) |
| 205 | s.ctx.Request.Header.Set("Content-Type", "application/json") |
| 206 | |
| 207 | s.a.CreateUser(s.ctx) |
| 208 | |
| 209 | assert.Equal(s.T(), 200, s.recorder.Code) |
| 210 | if created, err := s.db.GetUserByName("tom"); assert.NoError(s.T(), err) { |
| 211 | assert.NotNil(s.T(), created) |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | func (s *UserSuite) Test_CreateUser_Register_Admin_ByNonAdmin() { |
| 216 | s.a.Registration = true |
nothing calls this directly
no test coverage detected