MCPcopy Index your code
hub / github.com/gotify/server / Test_CreateUser_Register_Admin_ByNonAdmin

Method Test_CreateUser_Register_Admin_ByNonAdmin

api/user_test.go:215–226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

213}
214
215func (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
228func (s *UserSuite) Test_CreateUser_Anonymous() {
229 s.noLogin()

Callers

nothing calls this directly

Calls 3

loginUserMethod · 0.95
CreateUserMethod · 0.65

Tested by

no test coverage detected