mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 05:29:42 -06:00
706b301285
* feat(nested folders): add CountDashboardsInFolder This commit adds a new method to the Dashboard service and stores: CountDashboardsInFolder. The command struct takes a folderUID, but the store implementation still depends on the parent folder ID. This is temporary; eventually we will replace all references to FolderIDs (associated with Dashboards) with folder UIDs. There are some unfortunate additional test changes that were necessary after generating the service & store mocks; it looks like that hasn't been generated since the last change(s). * more test updates * don't forget the service test * that didn't end up used, so bye for now * agree to disagree with the linter
100 lines
2.6 KiB
Go
100 lines
2.6 KiB
Go
// Code generated by mockery v2.14.0. DO NOT EDIT.
|
|
|
|
package dashboards
|
|
|
|
import (
|
|
context "context"
|
|
|
|
models "github.com/grafana/grafana/pkg/models"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// FakeFolderStore is an autogenerated mock type for the FolderStore type
|
|
type FakeFolderStore struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// GetFolderByID provides a mock function with given fields: ctx, orgID, id
|
|
func (_m *FakeFolderStore) GetFolderByID(ctx context.Context, orgID int64, id int64) (*models.Folder, error) {
|
|
ret := _m.Called(ctx, orgID, id)
|
|
|
|
var r0 *models.Folder
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) *models.Folder); ok {
|
|
r0 = rf(ctx, orgID, id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.Folder)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, int64) error); ok {
|
|
r1 = rf(ctx, orgID, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetFolderByTitle provides a mock function with given fields: ctx, orgID, title
|
|
func (_m *FakeFolderStore) GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error) {
|
|
ret := _m.Called(ctx, orgID, title)
|
|
|
|
var r0 *models.Folder
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string) *models.Folder); ok {
|
|
r0 = rf(ctx, orgID, title)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.Folder)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string) error); ok {
|
|
r1 = rf(ctx, orgID, title)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetFolderByUID provides a mock function with given fields: ctx, orgID, uid
|
|
func (_m *FakeFolderStore) GetFolderByUID(ctx context.Context, orgID int64, uid string) (*models.Folder, error) {
|
|
ret := _m.Called(ctx, orgID, uid)
|
|
|
|
var r0 *models.Folder
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string) *models.Folder); ok {
|
|
r0 = rf(ctx, orgID, uid)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.Folder)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string) error); ok {
|
|
r1 = rf(ctx, orgID, uid)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
type mockConstructorTestingTNewFakeFolderStore interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}
|
|
|
|
// NewFakeFolderStore creates a new instance of FakeFolderStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewFakeFolderStore(t mockConstructorTestingTNewFakeFolderStore) *FakeFolderStore {
|
|
mock := &FakeFolderStore{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|