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

Method Test_UpdateClient_expectSuccess

api/client_test.go:190–209  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

188}
189
190func (s *ClientSuite) Test_UpdateClient_expectSuccess() {
191 s.db.User(5).NewClientWithToken(1, firstClientToken)
192
193 test.WithUser(s.ctx, 5)
194 s.withFormData("name=firefox")
195 s.ctx.Params = gin.Params{{Key: "id", Value: "1"}}
196 s.a.UpdateClient(s.ctx)
197
198 expected := &model.Client{
199 ID: 1,
200 Token: firstClientToken,
201 UserID: 5,
202 Name: "firefox",
203 }
204
205 assert.Equal(s.T(), 200, s.recorder.Code)
206 if client, err := s.db.GetClientByID(1); assert.NoError(s.T(), err) {
207 assert.Equal(s.T(), expected, client)
208 }
209}
210
211func (s *ClientSuite) Test_UpdateClient_expectNotFound() {
212 test.WithUser(s.ctx, 5)

Callers

nothing calls this directly

Calls 6

withFormDataMethod · 0.95
WithUserFunction · 0.92
NewClientWithTokenMethod · 0.80
UserMethod · 0.80
UpdateClientMethod · 0.65
GetClientByIDMethod · 0.65

Tested by

no test coverage detected