mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
remove bus from search and avoid import cycle (#46789)
* fix the import cicle * fix some unittest * fix removal bus from search
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/search"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
)
|
||||
|
||||
@@ -38,8 +37,10 @@ type SQLStoreMock struct {
|
||||
ExpectedDataSources []*models.DataSource
|
||||
ExpectedDataSourcesAccessStats []*models.DataSourceAccessStats
|
||||
ExpectedNotifierUsageStats []*models.NotifierUsageStats
|
||||
|
||||
ExpectedError error
|
||||
ExpectedPersistedDashboards models.HitList
|
||||
ExpectedSignedInUser *models.SignedInUser
|
||||
ExpectedUserStars map[int64]bool
|
||||
ExpectedError error
|
||||
}
|
||||
|
||||
func NewSQLStoreMock() *SQLStoreMock {
|
||||
@@ -179,10 +180,12 @@ func (m *SQLStoreMock) GetUserOrgList(ctx context.Context, query *models.GetUser
|
||||
}
|
||||
|
||||
func (m *SQLStoreMock) GetSignedInUserWithCacheCtx(ctx context.Context, query *models.GetSignedInUserQuery) error {
|
||||
query.Result = m.ExpectedSignedInUser
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
func (m *SQLStoreMock) GetSignedInUser(ctx context.Context, query *models.GetSignedInUserQuery) error {
|
||||
query.Result = m.ExpectedSignedInUser
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
@@ -322,6 +325,7 @@ func (m *SQLStoreMock) UnstarDashboard(ctx context.Context, cmd *models.UnstarDa
|
||||
}
|
||||
|
||||
func (m *SQLStoreMock) GetUserStars(ctx context.Context, query *models.GetUserStarsQuery) error {
|
||||
query.Result = m.ExpectedUserStars
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
@@ -469,7 +473,8 @@ func (m *SQLStoreMock) GetDashboard(ctx context.Context, query *models.GetDashbo
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
func (m SQLStoreMock) SearchDashboards(ctx context.Context, query *search.FindPersistedDashboardsQuery) error {
|
||||
func (m SQLStoreMock) SearchDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) error {
|
||||
query.Result = m.ExpectedPersistedDashboards
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user