2019-04-30 06:32:18 -05:00
|
|
|
package provisioning
|
|
|
|
|
|
|
|
type Calls struct {
|
|
|
|
ProvisionDatasources []interface{}
|
|
|
|
ProvisionNotifications []interface{}
|
|
|
|
ProvisionDashboards []interface{}
|
|
|
|
GetDashboardProvisionerResolvedPath []interface{}
|
2020-04-15 01:12:52 -05:00
|
|
|
GetAllowUIUpdatesFromConfig []interface{}
|
2019-04-30 06:32:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type ProvisioningServiceMock struct {
|
|
|
|
Calls *Calls
|
|
|
|
ProvisionDatasourcesFunc func() error
|
|
|
|
ProvisionNotificationsFunc func() error
|
|
|
|
ProvisionDashboardsFunc func() error
|
|
|
|
GetDashboardProvisionerResolvedPathFunc func(name string) string
|
2020-04-15 01:12:52 -05:00
|
|
|
GetAllowUIUpdatesFromConfigFunc func(name string) bool
|
2019-04-30 06:32:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewProvisioningServiceMock() *ProvisioningServiceMock {
|
|
|
|
return &ProvisioningServiceMock{
|
|
|
|
Calls: &Calls{},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mock *ProvisioningServiceMock) ProvisionDatasources() error {
|
|
|
|
mock.Calls.ProvisionDatasources = append(mock.Calls.ProvisionDatasources, nil)
|
|
|
|
if mock.ProvisionDatasourcesFunc != nil {
|
|
|
|
return mock.ProvisionDatasourcesFunc()
|
|
|
|
}
|
2019-05-15 16:29:26 -05:00
|
|
|
return nil
|
2019-04-30 06:32:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (mock *ProvisioningServiceMock) ProvisionNotifications() error {
|
|
|
|
mock.Calls.ProvisionNotifications = append(mock.Calls.ProvisionNotifications, nil)
|
|
|
|
if mock.ProvisionNotificationsFunc != nil {
|
|
|
|
return mock.ProvisionNotificationsFunc()
|
|
|
|
}
|
2019-05-15 16:29:26 -05:00
|
|
|
return nil
|
2019-04-30 06:32:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (mock *ProvisioningServiceMock) ProvisionDashboards() error {
|
|
|
|
mock.Calls.ProvisionDashboards = append(mock.Calls.ProvisionDashboards, nil)
|
|
|
|
if mock.ProvisionDashboardsFunc != nil {
|
|
|
|
return mock.ProvisionDashboardsFunc()
|
|
|
|
}
|
2019-05-15 16:29:26 -05:00
|
|
|
return nil
|
2019-04-30 06:32:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (mock *ProvisioningServiceMock) GetDashboardProvisionerResolvedPath(name string) string {
|
|
|
|
mock.Calls.GetDashboardProvisionerResolvedPath = append(mock.Calls.GetDashboardProvisionerResolvedPath, name)
|
|
|
|
if mock.GetDashboardProvisionerResolvedPathFunc != nil {
|
|
|
|
return mock.GetDashboardProvisionerResolvedPathFunc(name)
|
|
|
|
}
|
2019-05-15 16:29:26 -05:00
|
|
|
return ""
|
2019-04-30 06:32:18 -05:00
|
|
|
}
|
2019-10-31 08:27:31 -05:00
|
|
|
|
2020-04-15 01:12:52 -05:00
|
|
|
func (mock *ProvisioningServiceMock) GetAllowUIUpdatesFromConfig(name string) bool {
|
|
|
|
mock.Calls.GetAllowUIUpdatesFromConfig = append(mock.Calls.GetAllowUIUpdatesFromConfig, name)
|
|
|
|
if mock.GetAllowUIUpdatesFromConfigFunc != nil {
|
|
|
|
return mock.GetAllowUIUpdatesFromConfigFunc(name)
|
2019-10-31 08:27:31 -05:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|