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

Method Test_CreateMessage_WithoutTitle

api/message_test.go:400–415  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

398}
399
400func (s *MessageSuite) Test_CreateMessage_WithoutTitle() {
401 auth.RegisterAuthentication(s.ctx, nil, 4, "app-token")
402 s.db.User(4).AppWithTokenAndName(8, "app-token", "Application name")
403
404 s.ctx.Request = httptest.NewRequest("POST", "/message", strings.NewReader(`{"message": "mymessage"}`))
405 s.ctx.Request.Header.Set("Content-Type", "application/json")
406
407 s.a.CreateMessage(s.ctx)
408
409 msgs, err := s.db.GetMessagesByApplication(8)
410 assert.NoError(s.T(), err)
411 assert.Len(s.T(), msgs, 1)
412 assert.Equal(s.T(), "Application name", msgs[0].Title)
413 assert.Equal(s.T(), 200, s.recorder.Code)
414 assert.Equal(s.T(), "mymessage", s.notifiedMessage.Message)
415}
416
417func (s *MessageSuite) Test_CreateMessage_WithBlankTitle() {
418 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