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

Method Test_CreateUser_NameAlreadyExists

api/user_test.go:311–321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

309}
310
311func (s *UserSuite) Test_CreateUser_NameAlreadyExists() {
312 s.loginAdmin()
313 s.db.NewUserWithName(2, "tom")
314
315 s.ctx.Request = httptest.NewRequest("POST", "/user", strings.NewReader(`{"name": "tom", "pass": "mylittlepony", "admin": true}`))
316 s.ctx.Request.Header.Set("Content-Type", "application/json")
317
318 s.a.CreateUser(s.ctx)
319
320 assert.Equal(s.T(), 400, s.recorder.Code)
321}
322
323func (s *UserSuite) Test_UpdateUserByID_InvalidID() {
324 s.ctx.Params = gin.Params{{Key: "id", Value: "abc"}}

Callers

nothing calls this directly

Calls 3

loginAdminMethod · 0.95
NewUserWithNameMethod · 0.80
CreateUserMethod · 0.65

Tested by

no test coverage detected