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

Method Test_UpdateConfig_notImplemented_expect400

api/plugin_test.go:596–622  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

594}
595
596func (s *PluginSuite) Test_UpdateConfig_notImplemented_expect400() {
597 conf, err := s.db.GetPluginConfByUserAndPath(1, mock.ModulePath)
598 assert.NoError(s.T(), err)
599 inst, err := s.manager.Instance(conf.ID)
600 assert.Nil(s.T(), err)
601 mockInst := inst.(*mock.PluginInstance)
602
603 newConfig := &mock.PluginConfig{
604 TestKey: "test__new__config",
605 }
606 newConfigYAML, err := yaml.Marshal(newConfig)
607 assert.Nil(s.T(), err)
608
609 mockInst.SetCapability(compat.Configurer, false)
610 defer mockInst.SetCapability(compat.Configurer, true)
611
612 {
613 test.WithUser(s.ctx, 1)
614
615 s.ctx.Request = httptest.NewRequest("POST", fmt.Sprintf("/plugin/%d/config", conf.ID), bytes.NewReader(newConfigYAML))
616 s.ctx.Header("Content-Type", "application/x-yaml")
617 s.ctx.Params = gin.Params{{Key: "id", Value: fmt.Sprint(conf.ID)}}
618 s.a.UpdateConfig(s.ctx)
619
620 assert.Equal(s.T(), 400, s.recorder.Code)
621 }
622}
623
624func (s *PluginSuite) Test_UpdateConfig_incorrectUser_expectNotFound() {
625 conf, err := s.db.GetPluginConfByUserAndPath(1, mock.ModulePath)

Callers

nothing calls this directly

Calls 5

WithUserFunction · 0.92
InstanceMethod · 0.80
SetCapabilityMethod · 0.80
UpdateConfigMethod · 0.80

Tested by

no test coverage detected