Plugins: Move store and plugin dto to pluginsintegration (#74655)

move store and plugin dto
This commit is contained in:
Will Browne
2023-09-11 13:59:24 +02:00
committed by GitHub
parent 499b02b3c6
commit e855efb13d
63 changed files with 359 additions and 335 deletions
-31
View File
@@ -433,37 +433,6 @@ func (f *FakeOauthService) RegisterExternalService(ctx context.Context, name str
return f.Result, nil
}
type FakePluginStore struct {
PluginList []plugins.PluginDTO
}
func (pr *FakePluginStore) Plugin(_ context.Context, pluginID string) (plugins.PluginDTO, bool) {
for _, v := range pr.PluginList {
if v.ID == pluginID {
return v, true
}
}
return plugins.PluginDTO{}, false
}
func (pr *FakePluginStore) Plugins(_ context.Context, pluginTypes ...plugins.Type) []plugins.PluginDTO {
var result []plugins.PluginDTO
if len(pluginTypes) == 0 {
pluginTypes = plugins.PluginTypes
}
for _, v := range pr.PluginList {
for _, t := range pluginTypes {
if v.Type == t {
result = append(result, v)
}
}
}
return result
}
type FakeDiscoverer struct {
DiscoverFunc func(ctx context.Context, src plugins.PluginSource) ([]*plugins.FoundBundle, error)
}