-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathservices.go
More file actions
43 lines (37 loc) · 1.06 KB
/
services.go
File metadata and controls
43 lines (37 loc) · 1.06 KB
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
33
34
35
36
37
38
39
40
41
42
43
package mock
import (
"context"
"testing"
"github.com/src-d/lookout"
"github.com/stretchr/testify/require"
)
type MockChangesService struct {
T *testing.T
ExpectedRequest *lookout.ChangesRequest
ChangeScanner lookout.ChangeScanner
Error error
ModifyReq func(req *lookout.ChangesRequest)
}
func (r *MockChangesService) GetChanges(ctx context.Context, req *lookout.ChangesRequest) (lookout.ChangeScanner, error) {
require := require.New(r.T)
require.Equal(r.ExpectedRequest, req)
if r.ModifyReq != nil {
r.ModifyReq(req)
}
return r.ChangeScanner, r.Error
}
type MockFilesService struct {
T *testing.T
ExpectedRequest *lookout.FilesRequest
FileScanner lookout.FileScanner
Error error
ModifyReq func(req *lookout.FilesRequest)
}
func (r *MockFilesService) GetFiles(ctx context.Context, req *lookout.FilesRequest) (lookout.FileScanner, error) {
require := require.New(r.T)
require.Equal(r.ExpectedRequest, req)
if r.ModifyReq != nil {
r.ModifyReq(req)
}
return r.FileScanner, r.Error
}