grafana/pkg/services/star/startest/fake.go
ying-jeanne 2d4065600c
star sqlstore split (#45851)
* start for stars split

* some updates
2022-05-16 22:42:02 +08:00

34 lines
855 B
Go

package startest
import (
"context"
"github.com/grafana/grafana/pkg/services/star"
)
type FakeStarService struct {
ExpectedStars *star.Star
ExpectedError error
ExpectedUserStars *star.GetUserStarsResult
}
func NewStarServiceFake() *FakeStarService {
return &FakeStarService{}
}
func (f *FakeStarService) IsStarredByUser(ctx context.Context, query *star.IsStarredByUserQuery) (bool, error) {
return true, f.ExpectedError
}
func (f *FakeStarService) Add(ctx context.Context, cmd *star.StarDashboardCommand) error {
return f.ExpectedError
}
func (f *FakeStarService) Delete(ctx context.Context, cmd *star.UnstarDashboardCommand) error {
return f.ExpectedError
}
func (f *FakeStarService) GetByUser(ctx context.Context, query *star.GetUserStarsQuery) (*star.GetUserStarsResult, error) {
return f.ExpectedUserStars, f.ExpectedError
}