2022-02-16 14:15:44 +01:00
package dashboards
import (
2022-05-23 11:14:27 -04:00
context "context"
2023-05-24 15:33:35 +01:00
mock "github.com/stretchr/testify/mock"
2023-04-24 15:57:28 +02:00
2023-10-06 15:02:34 +02:00
"github.com/grafana/grafana/pkg/services/auth/identity"
model "github.com/grafana/grafana/pkg/services/search/model"
2022-02-16 14:15:44 +01:00
)
2022-05-23 11:14:27 -04:00
// FakeDashboardService is an autogenerated mock type for the DashboardService type
2022-02-16 14:15:44 +01:00
type FakeDashboardService struct {
2022-05-23 11:14:27 -04:00
mock . Mock
}
// BuildSaveDashboardCommand provides a mock function with given fields: ctx, dto, shouldValidateAlerts, validateProvisionedDashboard
2023-01-16 16:33:55 +01:00
func ( _m * FakeDashboardService ) BuildSaveDashboardCommand ( ctx context . Context , dto * SaveDashboardDTO , shouldValidateAlerts bool , validateProvisionedDashboard bool ) ( * SaveDashboardCommand , error ) {
2022-05-23 11:14:27 -04:00
ret := _m . Called ( ctx , dto , shouldValidateAlerts , validateProvisionedDashboard )
2022-02-16 14:15:44 +01:00
2023-01-16 16:33:55 +01:00
var r0 * SaveDashboardCommand
2023-04-24 15:57:28 +02:00
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * SaveDashboardDTO , bool , bool ) ( * SaveDashboardCommand , error ) ) ; ok {
return rf ( ctx , dto , shouldValidateAlerts , validateProvisionedDashboard )
}
2023-01-16 16:33:55 +01:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * SaveDashboardDTO , bool , bool ) * SaveDashboardCommand ) ; ok {
2022-05-23 11:14:27 -04:00
r0 = rf ( ctx , dto , shouldValidateAlerts , validateProvisionedDashboard )
} else {
if ret . Get ( 0 ) != nil {
2023-01-16 16:33:55 +01:00
r0 = ret . Get ( 0 ) . ( * SaveDashboardCommand )
2022-05-23 11:14:27 -04:00
}
}
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , * SaveDashboardDTO , bool , bool ) error ) ; ok {
r1 = rf ( ctx , dto , shouldValidateAlerts , validateProvisionedDashboard )
} else {
r1 = ret . Error ( 1 )
}
2022-05-17 14:52:22 -04:00
2022-05-23 11:14:27 -04:00
return r0 , r1
2022-02-16 14:15:44 +01:00
}
2023-08-23 12:54:06 +02:00
// CountInFolder provides a mock function with given fields: ctx, orgID, folderUID, _a3
2023-10-06 15:02:34 +02:00
func ( _m * FakeDashboardService ) CountInFolder ( ctx context . Context , orgID int64 , folderUID string , _a3 identity . Requester ) ( int64 , error ) {
2023-08-23 12:54:06 +02:00
ret := _m . Called ( ctx , orgID , folderUID , _a3 )
2022-11-02 09:15:50 -04:00
var r0 int64
2023-04-24 15:57:28 +02:00
var r1 error
2023-10-06 15:02:34 +02:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , int64 , string , identity . Requester ) ( int64 , error ) ) ; ok {
2023-08-23 12:54:06 +02:00
return rf ( ctx , orgID , folderUID , _a3 )
2023-04-24 15:57:28 +02:00
}
2023-10-06 15:02:34 +02:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , int64 , string , identity . Requester ) int64 ) ; ok {
2023-08-23 12:54:06 +02:00
r0 = rf ( ctx , orgID , folderUID , _a3 )
2022-11-02 09:15:50 -04:00
} else {
r0 = ret . Get ( 0 ) . ( int64 )
}
2023-10-06 15:02:34 +02:00
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , int64 , string , identity . Requester ) error ) ; ok {
2023-08-23 12:54:06 +02:00
r1 = rf ( ctx , orgID , folderUID , _a3 )
2022-11-02 09:15:50 -04:00
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
}
2022-05-23 11:14:27 -04:00
// DeleteDashboard provides a mock function with given fields: ctx, dashboardId, orgId
func ( _m * FakeDashboardService ) DeleteDashboard ( ctx context . Context , dashboardId int64 , orgId int64 ) error {
ret := _m . Called ( ctx , dashboardId , orgId )
2022-02-16 14:15:44 +01:00
2022-05-23 11:14:27 -04:00
var r0 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , int64 , int64 ) error ) ; ok {
r0 = rf ( ctx , dashboardId , orgId )
} else {
r0 = ret . Error ( 0 )
2022-02-16 14:15:44 +01:00
}
2022-05-23 11:14:27 -04:00
return r0
2022-02-16 14:15:44 +01:00
}
2022-05-23 11:14:27 -04:00
// FindDashboards provides a mock function with given fields: ctx, query
2023-01-26 08:46:30 -05:00
func ( _m * FakeDashboardService ) FindDashboards ( ctx context . Context , query * FindPersistedDashboardsQuery ) ( [ ] DashboardSearchProjection , error ) {
2022-05-23 11:14:27 -04:00
ret := _m . Called ( ctx , query )
var r0 [ ] DashboardSearchProjection
2023-04-24 15:57:28 +02:00
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * FindPersistedDashboardsQuery ) ( [ ] DashboardSearchProjection , error ) ) ; ok {
return rf ( ctx , query )
}
2023-01-26 08:46:30 -05:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * FindPersistedDashboardsQuery ) [ ] DashboardSearchProjection ) ; ok {
2022-05-23 11:14:27 -04:00
r0 = rf ( ctx , query )
} else {
if ret . Get ( 0 ) != nil {
r0 = ret . Get ( 0 ) . ( [ ] DashboardSearchProjection )
}
}
2023-01-26 08:46:30 -05:00
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , * FindPersistedDashboardsQuery ) error ) ; ok {
2022-05-23 11:14:27 -04:00
r1 = rf ( ctx , query )
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
2022-05-17 14:11:55 -08:00
}
2022-05-23 11:14:27 -04:00
// GetDashboard provides a mock function with given fields: ctx, query
2023-01-25 10:36:26 +01:00
func ( _m * FakeDashboardService ) GetDashboard ( ctx context . Context , query * GetDashboardQuery ) ( * Dashboard , error ) {
2022-05-23 11:14:27 -04:00
ret := _m . Called ( ctx , query )
2023-01-25 10:36:26 +01:00
var r0 * Dashboard
2023-04-24 15:57:28 +02:00
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * GetDashboardQuery ) ( * Dashboard , error ) ) ; ok {
return rf ( ctx , query )
}
2023-01-25 10:36:26 +01:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * GetDashboardQuery ) * Dashboard ) ; ok {
2022-05-23 11:14:27 -04:00
r0 = rf ( ctx , query )
} else {
2023-01-25 10:36:26 +01:00
if ret . Get ( 0 ) != nil {
r0 = ret . Get ( 0 ) . ( * Dashboard )
}
2022-05-23 11:14:27 -04:00
}
2023-01-25 10:36:26 +01:00
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , * GetDashboardQuery ) error ) ; ok {
r1 = rf ( ctx , query )
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
2022-05-23 11:14:27 -04:00
}
2022-06-02 10:00:47 -04:00
// GetDashboardTags provides a mock function with given fields: ctx, query
2023-01-25 10:36:26 +01:00
func ( _m * FakeDashboardService ) GetDashboardTags ( ctx context . Context , query * GetDashboardTagsQuery ) ( [ ] * DashboardTagCloudItem , error ) {
2022-06-02 10:00:47 -04:00
ret := _m . Called ( ctx , query )
2023-01-25 10:36:26 +01:00
var r0 [ ] * DashboardTagCloudItem
2023-04-24 15:57:28 +02:00
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * GetDashboardTagsQuery ) ( [ ] * DashboardTagCloudItem , error ) ) ; ok {
return rf ( ctx , query )
}
2023-01-25 10:36:26 +01:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * GetDashboardTagsQuery ) [ ] * DashboardTagCloudItem ) ; ok {
2022-06-02 10:00:47 -04:00
r0 = rf ( ctx , query )
} else {
2023-01-25 10:36:26 +01:00
if ret . Get ( 0 ) != nil {
r0 = ret . Get ( 0 ) . ( [ ] * DashboardTagCloudItem )
}
2022-06-02 10:00:47 -04:00
}
2023-01-25 10:36:26 +01:00
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , * GetDashboardTagsQuery ) error ) ; ok {
r1 = rf ( ctx , query )
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
2022-06-02 10:00:47 -04:00
}
2023-01-16 16:33:55 +01:00
// GetDashboardUIDByID provides a mock function with given fields: ctx, query
2023-01-25 10:36:26 +01:00
func ( _m * FakeDashboardService ) GetDashboardUIDByID ( ctx context . Context , query * GetDashboardRefByIDQuery ) ( * DashboardRef , error ) {
2022-05-23 11:14:27 -04:00
ret := _m . Called ( ctx , query )
2023-01-25 10:36:26 +01:00
var r0 * DashboardRef
2023-04-24 15:57:28 +02:00
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * GetDashboardRefByIDQuery ) ( * DashboardRef , error ) ) ; ok {
return rf ( ctx , query )
}
2023-01-25 10:36:26 +01:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * GetDashboardRefByIDQuery ) * DashboardRef ) ; ok {
2022-05-23 11:14:27 -04:00
r0 = rf ( ctx , query )
} else {
2023-01-25 10:36:26 +01:00
if ret . Get ( 0 ) != nil {
r0 = ret . Get ( 0 ) . ( * DashboardRef )
}
2022-05-23 11:14:27 -04:00
}
2023-01-25 10:36:26 +01:00
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , * GetDashboardRefByIDQuery ) error ) ; ok {
r1 = rf ( ctx , query )
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
2022-05-17 14:11:55 -08:00
}
2022-05-23 11:14:27 -04:00
// GetDashboards provides a mock function with given fields: ctx, query
2023-01-25 10:36:26 +01:00
func ( _m * FakeDashboardService ) GetDashboards ( ctx context . Context , query * GetDashboardsQuery ) ( [ ] * Dashboard , error ) {
2022-05-23 11:14:27 -04:00
ret := _m . Called ( ctx , query )
2023-01-25 10:36:26 +01:00
var r0 [ ] * Dashboard
2023-04-24 15:57:28 +02:00
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * GetDashboardsQuery ) ( [ ] * Dashboard , error ) ) ; ok {
return rf ( ctx , query )
}
2023-01-25 10:36:26 +01:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * GetDashboardsQuery ) [ ] * Dashboard ) ; ok {
2022-05-23 11:14:27 -04:00
r0 = rf ( ctx , query )
} else {
2023-01-25 10:36:26 +01:00
if ret . Get ( 0 ) != nil {
r0 = ret . Get ( 0 ) . ( [ ] * Dashboard )
}
2022-05-23 11:14:27 -04:00
}
2023-01-25 10:36:26 +01:00
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , * GetDashboardsQuery ) error ) ; ok {
r1 = rf ( ctx , query )
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
2022-05-23 11:14:27 -04:00
}
// ImportDashboard provides a mock function with given fields: ctx, dto
2023-01-16 16:33:55 +01:00
func ( _m * FakeDashboardService ) ImportDashboard ( ctx context . Context , dto * SaveDashboardDTO ) ( * Dashboard , error ) {
2022-05-23 11:14:27 -04:00
ret := _m . Called ( ctx , dto )
2023-01-16 16:33:55 +01:00
var r0 * Dashboard
2023-04-24 15:57:28 +02:00
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * SaveDashboardDTO ) ( * Dashboard , error ) ) ; ok {
return rf ( ctx , dto )
}
2023-01-16 16:33:55 +01:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * SaveDashboardDTO ) * Dashboard ) ; ok {
2022-05-23 11:14:27 -04:00
r0 = rf ( ctx , dto )
} else {
if ret . Get ( 0 ) != nil {
2023-01-16 16:33:55 +01:00
r0 = ret . Get ( 0 ) . ( * Dashboard )
2022-02-16 14:15:44 +01:00
}
}
2022-05-23 11:14:27 -04:00
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , * SaveDashboardDTO ) error ) ; ok {
r1 = rf ( ctx , dto )
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
2022-02-16 14:15:44 +01:00
}
2022-05-23 11:14:27 -04:00
// SaveDashboard provides a mock function with given fields: ctx, dto, allowUiUpdate
2023-01-16 16:33:55 +01:00
func ( _m * FakeDashboardService ) SaveDashboard ( ctx context . Context , dto * SaveDashboardDTO , allowUiUpdate bool ) ( * Dashboard , error ) {
2022-05-23 11:14:27 -04:00
ret := _m . Called ( ctx , dto , allowUiUpdate )
2023-01-16 16:33:55 +01:00
var r0 * Dashboard
2023-04-24 15:57:28 +02:00
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * SaveDashboardDTO , bool ) ( * Dashboard , error ) ) ; ok {
return rf ( ctx , dto , allowUiUpdate )
}
2023-01-16 16:33:55 +01:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * SaveDashboardDTO , bool ) * Dashboard ) ; ok {
2022-05-23 11:14:27 -04:00
r0 = rf ( ctx , dto , allowUiUpdate )
} else {
if ret . Get ( 0 ) != nil {
2023-01-16 16:33:55 +01:00
r0 = ret . Get ( 0 ) . ( * Dashboard )
2022-05-23 11:14:27 -04:00
}
}
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , * SaveDashboardDTO , bool ) error ) ; ok {
r1 = rf ( ctx , dto , allowUiUpdate )
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
2022-02-23 11:12:37 +01:00
}
2022-05-17 14:52:22 -04:00
2022-05-23 11:14:27 -04:00
// SearchDashboards provides a mock function with given fields: ctx, query
2023-03-30 07:29:52 +02:00
func ( _m * FakeDashboardService ) SearchDashboards ( ctx context . Context , query * FindPersistedDashboardsQuery ) ( model . HitList , error ) {
2022-05-23 11:14:27 -04:00
ret := _m . Called ( ctx , query )
2023-03-30 07:29:52 +02:00
var r0 model . HitList
2023-04-24 15:57:28 +02:00
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * FindPersistedDashboardsQuery ) ( model . HitList , error ) ) ; ok {
return rf ( ctx , query )
}
2023-03-30 07:29:52 +02:00
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , * FindPersistedDashboardsQuery ) model . HitList ) ; ok {
2022-05-23 11:14:27 -04:00
r0 = rf ( ctx , query )
} else {
2023-03-30 07:29:52 +02:00
if ret . Get ( 0 ) != nil {
r0 = ret . Get ( 0 ) . ( model . HitList )
}
2022-05-23 11:14:27 -04:00
}
2023-03-30 07:29:52 +02:00
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , * FindPersistedDashboardsQuery ) error ) ; ok {
r1 = rf ( ctx , query )
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
2022-05-19 10:13:02 -04:00
}
2022-05-19 10:59:12 -04:00
2023-12-05 16:13:31 +01:00
func ( _m * FakeDashboardService ) GetDashboardsSharedWithUser ( ctx context . Context , user identity . Requester ) ( [ ] * Dashboard , error ) {
ret := _m . Called ( ctx , user )
var r0 [ ] * Dashboard
var r1 error
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , identity . Requester ) ( [ ] * Dashboard , error ) ) ; ok {
return rf ( ctx , user )
}
if rf , ok := ret . Get ( 0 ) . ( func ( context . Context , identity . Requester ) [ ] * Dashboard ) ; ok {
r0 = rf ( ctx , user )
} else {
if ret . Get ( 0 ) != nil {
r0 = ret . Get ( 0 ) . ( [ ] * Dashboard )
}
}
if rf , ok := ret . Get ( 1 ) . ( func ( context . Context , identity . Requester ) error ) ; ok {
r1 = rf ( ctx , user )
} else {
r1 = ret . Error ( 1 )
}
return r0 , r1
}
2022-11-02 09:15:50 -04:00
type mockConstructorTestingTNewFakeDashboardService interface {
mock . TestingT
Cleanup ( func ( ) )
2022-07-19 16:01:05 +02:00
}
2022-11-02 09:15:50 -04:00
// NewFakeDashboardService creates a new instance of FakeDashboardService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewFakeDashboardService ( t mockConstructorTestingTNewFakeDashboardService ) * FakeDashboardService {
2022-05-23 11:14:27 -04:00
mock := & FakeDashboardService { }
mock . Mock . Test ( t )
t . Cleanup ( func ( ) { mock . AssertExpectations ( t ) } )
return mock
2022-05-19 10:59:12 -04:00
}