MCPcopy
hub / github.com/gotify/server / Test_CreateUser_Register_Anonymous

Method Test_CreateUser_Register_Anonymous

api/user_test.go:240–253  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

238}
239
240func (s *UserSuite) Test_CreateUser_Register_Anonymous() {
241 s.a.Registration = true
242 s.noLogin()
243
244 s.ctx.Request = httptest.NewRequest("POST", "/user", strings.NewReader(`{"name": "tom", "pass": "1", "admin": false}`))
245 s.ctx.Request.Header.Set("Content-Type", "application/json")
246
247 s.a.CreateUser(s.ctx)
248
249 assert.Equal(s.T(), 200, s.recorder.Code)
250 if created, err := s.db.GetUserByName("tom"); assert.NoError(s.T(), err) {
251 assert.NotNil(s.T(), created)
252 }
253}
254
255func (s *UserSuite) Test_CreateUser_Register_Admin_Anonymous() {
256 s.a.Registration = true

Callers

nothing calls this directly

Calls 3

noLoginMethod · 0.95
CreateUserMethod · 0.65
GetUserByNameMethod · 0.65

Tested by

no test coverage detected