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

Method Test_GetDisplay_incorrectUser_expectNotFound

api/plugin_test.go:332–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

330}
331
332func (s *PluginSuite) Test_GetDisplay_incorrectUser_expectNotFound() {
333 conf, err := s.db.GetPluginConfByUserAndPath(1, mock.ModulePath)
334 assert.NoError(s.T(), err)
335 inst, err := s.manager.Instance(conf.ID)
336 assert.Nil(s.T(), err)
337 mockInst := inst.(*mock.PluginInstance)
338
339 mockInst.DisplayString = "test string"
340
341 {
342 test.WithUser(s.ctx, 2)
343
344 s.ctx.Request = httptest.NewRequest("GET", fmt.Sprintf("/plugin/%d/display", conf.ID), nil)
345 s.ctx.Params = gin.Params{{Key: "id", Value: fmt.Sprint(conf.ID)}}
346 s.a.GetDisplay(s.ctx)
347
348 assert.Equal(s.T(), 404, s.recorder.Code)
349 }
350}
351
352func (s *PluginSuite) Test_GetDisplay_danglingConf_expectNotFound() {
353 conf := s.getDanglingConf(1)

Callers

nothing calls this directly

Calls 4

WithUserFunction · 0.92
InstanceMethod · 0.80
GetDisplayMethod · 0.65

Tested by

no test coverage detected