()
| 213 | } |
| 214 | |
| 215 | func (s *UserSuite) Test_CreateUser_Register_Admin_ByNonAdmin() { |
| 216 | s.a.Registration = true |
| 217 | s.loginUser() |
| 218 | |
| 219 | s.ctx.Request = httptest.NewRequest("POST", "/user", strings.NewReader(`{"name": "tom", "pass": "1", "admin": true}`)) |
| 220 | s.ctx.Request.Header.Set("Content-Type", "application/json") |
| 221 | |
| 222 | s.a.CreateUser(s.ctx) |
| 223 | |
| 224 | assert.Equal(s.T(), 403, s.recorder.Code) |
| 225 | s.db.AssertUsernameNotExist("tom") |
| 226 | } |
| 227 | |
| 228 | func (s *UserSuite) Test_CreateUser_Anonymous() { |
| 229 | s.noLogin() |
nothing calls this directly
no test coverage detected