mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* add ListDevices to service * improve fake * fix missing cfg field * cannot be unexported
33 lines
836 B
Go
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
|
|
}
|