Anon: Small fixes to anon service structure (#79566)
* add ListDevices to service * improve fake * fix missing cfg field * cannot be unexported
This commit is contained in:
@@ -6,10 +6,12 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/anonymous"
|
||||
"github.com/grafana/grafana/pkg/services/anonymous/anonimpl/anonstore"
|
||||
)
|
||||
|
||||
type FakeService struct {
|
||||
ExpectedCountDevices int64
|
||||
ExpectedListDevices []*anonstore.Device
|
||||
ExpectedError error
|
||||
}
|
||||
|
||||
@@ -17,13 +19,14 @@ func NewFakeService() *FakeService {
|
||||
return &FakeService{}
|
||||
}
|
||||
|
||||
type FakeAnonymousSessionService struct {
|
||||
}
|
||||
|
||||
func (f *FakeService) TagDevice(ctx context.Context, httpReq *http.Request, kind anonymous.DeviceKind) error {
|
||||
return nil
|
||||
return f.ExpectedError
|
||||
}
|
||||
|
||||
func (f *FakeService) CountDevices(ctx context.Context, from time.Time, to time.Time) (int64, error) {
|
||||
return f.ExpectedCountDevices, nil
|
||||
return f.ExpectedCountDevices, f.ExpectedError
|
||||
}
|
||||
|
||||
func (f *FakeService) ListDevices(ctx context.Context, from *time.Time, to *time.Time) ([]*anonstore.Device, error) {
|
||||
return f.ExpectedListDevices, f.ExpectedError
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user