forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfake.go
32 lines (25 loc) · 836 Bytes
/
fake.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
}