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

Method Test_CreateMessage_WithBlankTitle

api/message_test.go:417–432  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

415}
416
417func (s *MessageSuite) Test_CreateMessage_WithBlankTitle() {
418 auth.RegisterAuthentication(s.ctx, nil, 4, "app-token")
419 s.db.User(4).AppWithTokenAndName(8, "app-token", "Application name")
420
421 s.ctx.Request = httptest.NewRequest("POST", "/message", strings.NewReader(`{"message": "mymessage", "title": " "}`))
422 s.ctx.Request.Header.Set("Content-Type", "application/json")
423
424 s.a.CreateMessage(s.ctx)
425
426 msgs, err := s.db.GetMessagesByApplication(8)
427 assert.NoError(s.T(), err)
428 assert.Len(s.T(), msgs, 1)
429 assert.Equal(s.T(), "Application name", msgs[0].Title)
430 assert.Equal(s.T(), 200, s.recorder.Code)
431 assert.Equal(s.T(), "mymessage", msgs[0].Message)
432}
433
434func (s *MessageSuite) Test_CreateMessage_IgnoreID() {
435 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