grafana/pkg/services/anonymous/anontest/fake.go
Jo ffbf1b1413
Anon: Small fixes to anon service structure (#79566)
* add ListDevices to service

* improve fake

* fix missing cfg field

* cannot be unexported
2023-12-15 15:15:04 +01:00

33 lines
836 B
Go

package anontest
import (
"context"
"net/http"
"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
}
func NewFakeService() *FakeService {
return &FakeService{}
}
func (f *FakeService) TagDevice(ctx context.Context, httpReq *http.Request, kind anonymous.DeviceKind) error {
return f.ExpectedError
}
func (f *FakeService) CountDevices(ctx context.Context, from time.Time, to time.Time) (int64, error) {
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
}