/
fake_filter.go
245 lines (223 loc) · 6.35 KB
/
fake_filter.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
// Code generated by counterfeiter. DO NOT EDIT.
package webfakes
import (
"sync"
"github.com/Peripli/service-manager/pkg/web"
)
type FakeFilter struct {
FilterMatchersStub func() []web.FilterMatcher
filterMatchersMutex sync.RWMutex
filterMatchersArgsForCall []struct {
}
filterMatchersReturns struct {
result1 []web.FilterMatcher
}
filterMatchersReturnsOnCall map[int]struct {
result1 []web.FilterMatcher
}
NameStub func() string
nameMutex sync.RWMutex
nameArgsForCall []struct {
}
nameReturns struct {
result1 string
}
nameReturnsOnCall map[int]struct {
result1 string
}
RunStub func(*web.Request, web.Handler) (*web.Response, error)
runMutex sync.RWMutex
runArgsForCall []struct {
arg1 *web.Request
arg2 web.Handler
}
runReturns struct {
result1 *web.Response
result2 error
}
runReturnsOnCall map[int]struct {
result1 *web.Response
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeFilter) FilterMatchers() []web.FilterMatcher {
fake.filterMatchersMutex.Lock()
ret, specificReturn := fake.filterMatchersReturnsOnCall[len(fake.filterMatchersArgsForCall)]
fake.filterMatchersArgsForCall = append(fake.filterMatchersArgsForCall, struct {
}{})
fake.recordInvocation("FilterMatchers", []interface{}{})
fake.filterMatchersMutex.Unlock()
if fake.FilterMatchersStub != nil {
return fake.FilterMatchersStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.filterMatchersReturns
return fakeReturns.result1
}
func (fake *FakeFilter) FilterMatchersCallCount() int {
fake.filterMatchersMutex.RLock()
defer fake.filterMatchersMutex.RUnlock()
return len(fake.filterMatchersArgsForCall)
}
func (fake *FakeFilter) FilterMatchersCalls(stub func() []web.FilterMatcher) {
fake.filterMatchersMutex.Lock()
defer fake.filterMatchersMutex.Unlock()
fake.FilterMatchersStub = stub
}
func (fake *FakeFilter) FilterMatchersReturns(result1 []web.FilterMatcher) {
fake.filterMatchersMutex.Lock()
defer fake.filterMatchersMutex.Unlock()
fake.FilterMatchersStub = nil
fake.filterMatchersReturns = struct {
result1 []web.FilterMatcher
}{result1}
}
func (fake *FakeFilter) FilterMatchersReturnsOnCall(i int, result1 []web.FilterMatcher) {
fake.filterMatchersMutex.Lock()
defer fake.filterMatchersMutex.Unlock()
fake.FilterMatchersStub = nil
if fake.filterMatchersReturnsOnCall == nil {
fake.filterMatchersReturnsOnCall = make(map[int]struct {
result1 []web.FilterMatcher
})
}
fake.filterMatchersReturnsOnCall[i] = struct {
result1 []web.FilterMatcher
}{result1}
}
func (fake *FakeFilter) Name() string {
fake.nameMutex.Lock()
ret, specificReturn := fake.nameReturnsOnCall[len(fake.nameArgsForCall)]
fake.nameArgsForCall = append(fake.nameArgsForCall, struct {
}{})
fake.recordInvocation("Name", []interface{}{})
fake.nameMutex.Unlock()
if fake.NameStub != nil {
return fake.NameStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.nameReturns
return fakeReturns.result1
}
func (fake *FakeFilter) NameCallCount() int {
fake.nameMutex.RLock()
defer fake.nameMutex.RUnlock()
return len(fake.nameArgsForCall)
}
func (fake *FakeFilter) NameCalls(stub func() string) {
fake.nameMutex.Lock()
defer fake.nameMutex.Unlock()
fake.NameStub = stub
}
func (fake *FakeFilter) NameReturns(result1 string) {
fake.nameMutex.Lock()
defer fake.nameMutex.Unlock()
fake.NameStub = nil
fake.nameReturns = struct {
result1 string
}{result1}
}
func (fake *FakeFilter) NameReturnsOnCall(i int, result1 string) {
fake.nameMutex.Lock()
defer fake.nameMutex.Unlock()
fake.NameStub = nil
if fake.nameReturnsOnCall == nil {
fake.nameReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.nameReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *FakeFilter) Run(arg1 *web.Request, arg2 web.Handler) (*web.Response, error) {
fake.runMutex.Lock()
ret, specificReturn := fake.runReturnsOnCall[len(fake.runArgsForCall)]
fake.runArgsForCall = append(fake.runArgsForCall, struct {
arg1 *web.Request
arg2 web.Handler
}{arg1, arg2})
fake.recordInvocation("Run", []interface{}{arg1, arg2})
fake.runMutex.Unlock()
if fake.RunStub != nil {
return fake.RunStub(arg1, arg2)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.runReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeFilter) RunCallCount() int {
fake.runMutex.RLock()
defer fake.runMutex.RUnlock()
return len(fake.runArgsForCall)
}
func (fake *FakeFilter) RunCalls(stub func(*web.Request, web.Handler) (*web.Response, error)) {
fake.runMutex.Lock()
defer fake.runMutex.Unlock()
fake.RunStub = stub
}
func (fake *FakeFilter) RunArgsForCall(i int) (*web.Request, web.Handler) {
fake.runMutex.RLock()
defer fake.runMutex.RUnlock()
argsForCall := fake.runArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeFilter) RunReturns(result1 *web.Response, result2 error) {
fake.runMutex.Lock()
defer fake.runMutex.Unlock()
fake.RunStub = nil
fake.runReturns = struct {
result1 *web.Response
result2 error
}{result1, result2}
}
func (fake *FakeFilter) RunReturnsOnCall(i int, result1 *web.Response, result2 error) {
fake.runMutex.Lock()
defer fake.runMutex.Unlock()
fake.RunStub = nil
if fake.runReturnsOnCall == nil {
fake.runReturnsOnCall = make(map[int]struct {
result1 *web.Response
result2 error
})
}
fake.runReturnsOnCall[i] = struct {
result1 *web.Response
result2 error
}{result1, result2}
}
func (fake *FakeFilter) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.filterMatchersMutex.RLock()
defer fake.filterMatchersMutex.RUnlock()
fake.nameMutex.RLock()
defer fake.nameMutex.RUnlock()
fake.runMutex.RLock()
defer fake.runMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeFilter) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ web.Filter = new(FakeFilter)