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

Method Test_GetDisplay

api/plugin_test.go:289–308  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

287}
288
289func (s *PluginSuite) Test_GetDisplay() {
290 conf, err := s.db.GetPluginConfByUserAndPath(1, mock.ModulePath)
291 assert.NoError(s.T(), err)
292 inst, err := s.manager.Instance(conf.ID)
293 assert.Nil(s.T(), err)
294 mockInst := inst.(*mock.PluginInstance)
295
296 mockInst.DisplayString = "test string"
297
298 {
299 test.WithUser(s.ctx, 1)
300
301 s.ctx.Request = httptest.NewRequest("GET", fmt.Sprintf("/plugin/%d/display", conf.ID), nil)
302 s.ctx.Params = gin.Params{{Key: "id", Value: fmt.Sprint(conf.ID)}}
303 s.a.GetDisplay(s.ctx)
304
305 assert.Equal(s.T(), 200, s.recorder.Code)
306 test.JSONEquals(s.T(), mockInst.DisplayString, s.recorder.Body.String())
307 }
308}
309
310func (s *PluginSuite) Test_GetDisplay_NotImplemented_expectEmptyString() {
311 conf, err := s.db.GetPluginConfByUserAndPath(1, mock.ModulePath)

Callers

nothing calls this directly

Calls 6

WithUserFunction · 0.92
JSONEqualsFunction · 0.92
InstanceMethod · 0.80
StringMethod · 0.80
GetDisplayMethod · 0.65

Tested by

no test coverage detected