()
| 594 | } |
| 595 | |
| 596 | func (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 | |
| 624 | func (s *PluginSuite) Test_UpdateConfig_incorrectUser_expectNotFound() { |
| 625 | conf, err := s.db.GetPluginConfByUserAndPath(1, mock.ModulePath) |
nothing calls this directly
no test coverage detected