forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_authentication_repository.go
160 lines (142 loc) · 5.27 KB
/
fake_authentication_repository.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
// This file was generated by counterfeiter
package fakes
import (
"sync"
"github.com/cloudfoundry/cli/cf/api/authentication"
"github.com/cloudfoundry/cli/cf/configuration/core_config"
)
type FakeAuthenticationRepository struct {
RefreshAuthTokenStub func() (updatedToken string, apiErr error)
refreshAuthTokenMutex sync.RWMutex
refreshAuthTokenArgsForCall []struct{}
refreshAuthTokenReturns struct {
result1 string
result2 error
}
AuthenticateStub func(credentials map[string]string) (apiErr error)
authenticateMutex sync.RWMutex
authenticateArgsForCall []struct {
credentials map[string]string
}
authenticateReturns struct {
result1 error
}
AuthorizeStub func(token string) (string, error)
authorizeMutex sync.RWMutex
authorizeArgsForCall []struct {
token string
}
authorizeReturns struct {
result1 string
result2 error
}
GetLoginPromptsAndSaveUAAServerURLStub func() (map[string]core_config.AuthPrompt, error)
getLoginPromptsAndSaveUAAServerURLMutex sync.RWMutex
getLoginPromptsAndSaveUAAServerURLArgsForCall []struct{}
getLoginPromptsAndSaveUAAServerURLReturns struct {
result1 map[string]core_config.AuthPrompt
result2 error
}
}
func (fake *FakeAuthenticationRepository) RefreshAuthToken() (updatedToken string, apiErr error) {
fake.refreshAuthTokenMutex.Lock()
fake.refreshAuthTokenArgsForCall = append(fake.refreshAuthTokenArgsForCall, struct{}{})
fake.refreshAuthTokenMutex.Unlock()
if fake.RefreshAuthTokenStub != nil {
return fake.RefreshAuthTokenStub()
} else {
return fake.refreshAuthTokenReturns.result1, fake.refreshAuthTokenReturns.result2
}
}
func (fake *FakeAuthenticationRepository) RefreshAuthTokenCallCount() int {
fake.refreshAuthTokenMutex.RLock()
defer fake.refreshAuthTokenMutex.RUnlock()
return len(fake.refreshAuthTokenArgsForCall)
}
func (fake *FakeAuthenticationRepository) RefreshAuthTokenReturns(result1 string, result2 error) {
fake.RefreshAuthTokenStub = nil
fake.refreshAuthTokenReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeAuthenticationRepository) Authenticate(credentials map[string]string) (apiErr error) {
fake.authenticateMutex.Lock()
fake.authenticateArgsForCall = append(fake.authenticateArgsForCall, struct {
credentials map[string]string
}{credentials})
fake.authenticateMutex.Unlock()
if fake.AuthenticateStub != nil {
return fake.AuthenticateStub(credentials)
} else {
return fake.authenticateReturns.result1
}
}
func (fake *FakeAuthenticationRepository) AuthenticateCallCount() int {
fake.authenticateMutex.RLock()
defer fake.authenticateMutex.RUnlock()
return len(fake.authenticateArgsForCall)
}
func (fake *FakeAuthenticationRepository) AuthenticateArgsForCall(i int) map[string]string {
fake.authenticateMutex.RLock()
defer fake.authenticateMutex.RUnlock()
return fake.authenticateArgsForCall[i].credentials
}
func (fake *FakeAuthenticationRepository) AuthenticateReturns(result1 error) {
fake.AuthenticateStub = nil
fake.authenticateReturns = struct {
result1 error
}{result1}
}
func (fake *FakeAuthenticationRepository) Authorize(token string) (string, error) {
fake.authorizeMutex.Lock()
fake.authorizeArgsForCall = append(fake.authorizeArgsForCall, struct {
token string
}{token})
fake.authorizeMutex.Unlock()
if fake.AuthorizeStub != nil {
return fake.AuthorizeStub(token)
} else {
return fake.authorizeReturns.result1, fake.authorizeReturns.result2
}
}
func (fake *FakeAuthenticationRepository) AuthorizeCallCount() int {
fake.authorizeMutex.RLock()
defer fake.authorizeMutex.RUnlock()
return len(fake.authorizeArgsForCall)
}
func (fake *FakeAuthenticationRepository) AuthorizeArgsForCall(i int) string {
fake.authorizeMutex.RLock()
defer fake.authorizeMutex.RUnlock()
return fake.authorizeArgsForCall[i].token
}
func (fake *FakeAuthenticationRepository) AuthorizeReturns(result1 string, result2 error) {
fake.AuthorizeStub = nil
fake.authorizeReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeAuthenticationRepository) GetLoginPromptsAndSaveUAAServerURL() (map[string]core_config.AuthPrompt, error) {
fake.getLoginPromptsAndSaveUAAServerURLMutex.Lock()
fake.getLoginPromptsAndSaveUAAServerURLArgsForCall = append(fake.getLoginPromptsAndSaveUAAServerURLArgsForCall, struct{}{})
fake.getLoginPromptsAndSaveUAAServerURLMutex.Unlock()
if fake.GetLoginPromptsAndSaveUAAServerURLStub != nil {
return fake.GetLoginPromptsAndSaveUAAServerURLStub()
} else {
return fake.getLoginPromptsAndSaveUAAServerURLReturns.result1, fake.getLoginPromptsAndSaveUAAServerURLReturns.result2
}
}
func (fake *FakeAuthenticationRepository) GetLoginPromptsAndSaveUAAServerURLCallCount() int {
fake.getLoginPromptsAndSaveUAAServerURLMutex.RLock()
defer fake.getLoginPromptsAndSaveUAAServerURLMutex.RUnlock()
return len(fake.getLoginPromptsAndSaveUAAServerURLArgsForCall)
}
func (fake *FakeAuthenticationRepository) GetLoginPromptsAndSaveUAAServerURLReturns(result1 map[string]core_config.AuthPrompt, result2 error) {
fake.GetLoginPromptsAndSaveUAAServerURLStub = nil
fake.getLoginPromptsAndSaveUAAServerURLReturns = struct {
result1 map[string]core_config.AuthPrompt
result2 error
}{result1, result2}
}
var _ authentication.AuthenticationRepository = new(FakeAuthenticationRepository)