()
| 376 | } |
| 377 | |
| 378 | func (s *PluginSuite) Test_GetConfig() { |
| 379 | conf, err := s.db.GetPluginConfByUserAndPath(1, mock.ModulePath) |
| 380 | assert.NoError(s.T(), err) |
| 381 | inst, err := s.manager.Instance(conf.ID) |
| 382 | assert.Nil(s.T(), err) |
| 383 | mockInst := inst.(*mock.PluginInstance) |
| 384 | |
| 385 | assert.Equal(s.T(), mockInst.DefaultConfig(), mockInst.Config, "Initial config should be default config") |
| 386 | { |
| 387 | test.WithUser(s.ctx, 1) |
| 388 | |
| 389 | s.ctx.Request = httptest.NewRequest("GET", fmt.Sprintf("/plugin/%d/config", conf.ID), nil) |
| 390 | s.ctx.Params = gin.Params{{Key: "id", Value: fmt.Sprint(conf.ID)}} |
| 391 | s.a.GetConfig(s.ctx) |
| 392 | |
| 393 | assert.Equal(s.T(), 200, s.recorder.Code) |
| 394 | returnedConfig := new(mock.PluginConfig) |
| 395 | assert.Nil(s.T(), yaml.Unmarshal(s.recorder.Body.Bytes(), returnedConfig)) |
| 396 | assert.Equal(s.T(), mockInst.Config, returnedConfig) |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | func (s *PluginSuite) Test_GetConfg_notImplemeted_expect400() { |
| 401 | conf, err := s.db.GetPluginConfByUserAndPath(1, mock.ModulePath) |
nothing calls this directly
no test coverage detected