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

Method Test_CreateMessage_IgnoreID

api/message_test.go:434–448  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

432}
433
434func (s *MessageSuite) Test_CreateMessage_IgnoreID() {
435 auth.RegisterAuthentication(s.ctx, nil, 4, "app-token")
436 s.db.User(4).AppWithTokenAndName(8, "app-token", "Application name")
437
438 s.ctx.Request = httptest.NewRequest("POST", "/message", strings.NewReader(`{"message": "mymessage", "id": 1337}`))
439 s.ctx.Request.Header.Set("Content-Type", "application/json")
440
441 s.a.CreateMessage(s.ctx)
442
443 msgs, err := s.db.GetMessagesByApplication(8)
444 assert.NoError(s.T(), err)
445 assert.Len(s.T(), msgs, 1)
446 assert.NotEqual(s.T(), msgs[0].ID, uint(1337))
447 assert.Equal(s.T(), 200, s.recorder.Code)
448}
449
450func (s *MessageSuite) Test_CreateMessage_WithExtras() {
451 auth.RegisterAuthentication(s.ctx, nil, 4, "app-token")

Callers

nothing calls this directly

Calls 5

RegisterAuthenticationFunction · 0.92
AppWithTokenAndNameMethod · 0.80
UserMethod · 0.80
CreateMessageMethod · 0.65

Tested by

no test coverage detected