forked from csigo/config
-
Notifications
You must be signed in to change notification settings - Fork 2
/
mock_client.go
53 lines (43 loc) · 1.26 KB
/
mock_client.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package config
import (
"regexp"
"github.com/stretchr/testify/mock"
)
// MockClient is the mock struct
type MockClient struct {
mock.Mock
}
// ConfigInfo is the mock function.
func (m *MockClient) ConfigInfo() ConfigInfo {
args := m.Called()
return args.Get(0).(ConfigInfo)
}
// Get is the mock function.
func (m *MockClient) Get(path string) ([]byte, error) {
args := m.Called(path)
return args.Get(0).([]byte), args.Error(1)
}
// AddListener is the mock function.
func (m *MockClient) AddListener(pathRegEx *regexp.Regexp) *chan ModifiedFile {
args := m.Called(pathRegEx)
return args.Get(0).(*chan ModifiedFile)
}
// RemoveListener is the mock function.
func (m *MockClient) RemoveListener(ch *chan ModifiedFile) {
m.Called(ch)
}
// Stop is to stop client
func (m *MockClient) Stop() error {
args := m.Called()
return args.Error(0)
}
// List is the mock function.
func (m *MockClient) List(path string) (map[string][]byte, error) {
args := m.Called(path)
return args.Get(0).(map[string][]byte), args.Error(1)
}
// Watch watches change of a file and invokes callback. It also invokes callback for the
func (m *MockClient) Watch(path string, callback func([]byte) error, errChan chan<- error) error {
args := m.Called(path, callback, errChan)
return args.Error(0)
}