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

Method Test_CreateUser_Register_ByNonAdmin

api/user_test.go:200–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

198}
199
200func (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
215func (s *UserSuite) Test_CreateUser_Register_Admin_ByNonAdmin() {
216 s.a.Registration = true

Callers

nothing calls this directly

Calls 3

loginUserMethod · 0.95
CreateUserMethod · 0.65
GetUserByNameMethod · 0.65

Tested by

no test coverage detected