-
Notifications
You must be signed in to change notification settings - Fork 153
/
fake_github_auth_client.go
263 lines (240 loc) · 8.16 KB
/
fake_github_auth_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
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
// Code generated by counterfeiter. DO NOT EDIT.
package authfakes
import (
"context"
"sync"
"github.com/weaveworks/weave-gitops/pkg/services/auth"
)
type FakeGithubAuthClient struct {
GetDeviceCodeStub func() (*auth.GithubDeviceCodeResponse, error)
getDeviceCodeMutex sync.RWMutex
getDeviceCodeArgsForCall []struct {
}
getDeviceCodeReturns struct {
result1 *auth.GithubDeviceCodeResponse
result2 error
}
getDeviceCodeReturnsOnCall map[int]struct {
result1 *auth.GithubDeviceCodeResponse
result2 error
}
GetDeviceCodeAuthStatusStub func(string) (string, error)
getDeviceCodeAuthStatusMutex sync.RWMutex
getDeviceCodeAuthStatusArgsForCall []struct {
arg1 string
}
getDeviceCodeAuthStatusReturns struct {
result1 string
result2 error
}
getDeviceCodeAuthStatusReturnsOnCall map[int]struct {
result1 string
result2 error
}
ValidateTokenStub func(context.Context, string) error
validateTokenMutex sync.RWMutex
validateTokenArgsForCall []struct {
arg1 context.Context
arg2 string
}
validateTokenReturns struct {
result1 error
}
validateTokenReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeGithubAuthClient) GetDeviceCode() (*auth.GithubDeviceCodeResponse, error) {
fake.getDeviceCodeMutex.Lock()
ret, specificReturn := fake.getDeviceCodeReturnsOnCall[len(fake.getDeviceCodeArgsForCall)]
fake.getDeviceCodeArgsForCall = append(fake.getDeviceCodeArgsForCall, struct {
}{})
stub := fake.GetDeviceCodeStub
fakeReturns := fake.getDeviceCodeReturns
fake.recordInvocation("GetDeviceCode", []interface{}{})
fake.getDeviceCodeMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1, ret.result2
}
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeGithubAuthClient) GetDeviceCodeCallCount() int {
fake.getDeviceCodeMutex.RLock()
defer fake.getDeviceCodeMutex.RUnlock()
return len(fake.getDeviceCodeArgsForCall)
}
func (fake *FakeGithubAuthClient) GetDeviceCodeCalls(stub func() (*auth.GithubDeviceCodeResponse, error)) {
fake.getDeviceCodeMutex.Lock()
defer fake.getDeviceCodeMutex.Unlock()
fake.GetDeviceCodeStub = stub
}
func (fake *FakeGithubAuthClient) GetDeviceCodeReturns(result1 *auth.GithubDeviceCodeResponse, result2 error) {
fake.getDeviceCodeMutex.Lock()
defer fake.getDeviceCodeMutex.Unlock()
fake.GetDeviceCodeStub = nil
fake.getDeviceCodeReturns = struct {
result1 *auth.GithubDeviceCodeResponse
result2 error
}{result1, result2}
}
func (fake *FakeGithubAuthClient) GetDeviceCodeReturnsOnCall(i int, result1 *auth.GithubDeviceCodeResponse, result2 error) {
fake.getDeviceCodeMutex.Lock()
defer fake.getDeviceCodeMutex.Unlock()
fake.GetDeviceCodeStub = nil
if fake.getDeviceCodeReturnsOnCall == nil {
fake.getDeviceCodeReturnsOnCall = make(map[int]struct {
result1 *auth.GithubDeviceCodeResponse
result2 error
})
}
fake.getDeviceCodeReturnsOnCall[i] = struct {
result1 *auth.GithubDeviceCodeResponse
result2 error
}{result1, result2}
}
func (fake *FakeGithubAuthClient) GetDeviceCodeAuthStatus(arg1 string) (string, error) {
fake.getDeviceCodeAuthStatusMutex.Lock()
ret, specificReturn := fake.getDeviceCodeAuthStatusReturnsOnCall[len(fake.getDeviceCodeAuthStatusArgsForCall)]
fake.getDeviceCodeAuthStatusArgsForCall = append(fake.getDeviceCodeAuthStatusArgsForCall, struct {
arg1 string
}{arg1})
stub := fake.GetDeviceCodeAuthStatusStub
fakeReturns := fake.getDeviceCodeAuthStatusReturns
fake.recordInvocation("GetDeviceCodeAuthStatus", []interface{}{arg1})
fake.getDeviceCodeAuthStatusMutex.Unlock()
if stub != nil {
return stub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeGithubAuthClient) GetDeviceCodeAuthStatusCallCount() int {
fake.getDeviceCodeAuthStatusMutex.RLock()
defer fake.getDeviceCodeAuthStatusMutex.RUnlock()
return len(fake.getDeviceCodeAuthStatusArgsForCall)
}
func (fake *FakeGithubAuthClient) GetDeviceCodeAuthStatusCalls(stub func(string) (string, error)) {
fake.getDeviceCodeAuthStatusMutex.Lock()
defer fake.getDeviceCodeAuthStatusMutex.Unlock()
fake.GetDeviceCodeAuthStatusStub = stub
}
func (fake *FakeGithubAuthClient) GetDeviceCodeAuthStatusArgsForCall(i int) string {
fake.getDeviceCodeAuthStatusMutex.RLock()
defer fake.getDeviceCodeAuthStatusMutex.RUnlock()
argsForCall := fake.getDeviceCodeAuthStatusArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeGithubAuthClient) GetDeviceCodeAuthStatusReturns(result1 string, result2 error) {
fake.getDeviceCodeAuthStatusMutex.Lock()
defer fake.getDeviceCodeAuthStatusMutex.Unlock()
fake.GetDeviceCodeAuthStatusStub = nil
fake.getDeviceCodeAuthStatusReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeGithubAuthClient) GetDeviceCodeAuthStatusReturnsOnCall(i int, result1 string, result2 error) {
fake.getDeviceCodeAuthStatusMutex.Lock()
defer fake.getDeviceCodeAuthStatusMutex.Unlock()
fake.GetDeviceCodeAuthStatusStub = nil
if fake.getDeviceCodeAuthStatusReturnsOnCall == nil {
fake.getDeviceCodeAuthStatusReturnsOnCall = make(map[int]struct {
result1 string
result2 error
})
}
fake.getDeviceCodeAuthStatusReturnsOnCall[i] = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeGithubAuthClient) ValidateToken(arg1 context.Context, arg2 string) error {
fake.validateTokenMutex.Lock()
ret, specificReturn := fake.validateTokenReturnsOnCall[len(fake.validateTokenArgsForCall)]
fake.validateTokenArgsForCall = append(fake.validateTokenArgsForCall, struct {
arg1 context.Context
arg2 string
}{arg1, arg2})
stub := fake.ValidateTokenStub
fakeReturns := fake.validateTokenReturns
fake.recordInvocation("ValidateToken", []interface{}{arg1, arg2})
fake.validateTokenMutex.Unlock()
if stub != nil {
return stub(arg1, arg2)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeGithubAuthClient) ValidateTokenCallCount() int {
fake.validateTokenMutex.RLock()
defer fake.validateTokenMutex.RUnlock()
return len(fake.validateTokenArgsForCall)
}
func (fake *FakeGithubAuthClient) ValidateTokenCalls(stub func(context.Context, string) error) {
fake.validateTokenMutex.Lock()
defer fake.validateTokenMutex.Unlock()
fake.ValidateTokenStub = stub
}
func (fake *FakeGithubAuthClient) ValidateTokenArgsForCall(i int) (context.Context, string) {
fake.validateTokenMutex.RLock()
defer fake.validateTokenMutex.RUnlock()
argsForCall := fake.validateTokenArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeGithubAuthClient) ValidateTokenReturns(result1 error) {
fake.validateTokenMutex.Lock()
defer fake.validateTokenMutex.Unlock()
fake.ValidateTokenStub = nil
fake.validateTokenReturns = struct {
result1 error
}{result1}
}
func (fake *FakeGithubAuthClient) ValidateTokenReturnsOnCall(i int, result1 error) {
fake.validateTokenMutex.Lock()
defer fake.validateTokenMutex.Unlock()
fake.ValidateTokenStub = nil
if fake.validateTokenReturnsOnCall == nil {
fake.validateTokenReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.validateTokenReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeGithubAuthClient) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.getDeviceCodeMutex.RLock()
defer fake.getDeviceCodeMutex.RUnlock()
fake.getDeviceCodeAuthStatusMutex.RLock()
defer fake.getDeviceCodeAuthStatusMutex.RUnlock()
fake.validateTokenMutex.RLock()
defer fake.validateTokenMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeGithubAuthClient) 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 _ auth.GithubAuthClient = new(FakeGithubAuthClient)