github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/fake_service_auth_token_repository.go (about) 1 // This file was generated by counterfeiter 2 package apifakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeServiceAuthTokenRepository struct { 12 FindAllStub func() (authTokens []models.ServiceAuthTokenFields, apiErr error) 13 findAllMutex sync.RWMutex 14 findAllArgsForCall []struct{} 15 findAllReturns struct { 16 result1 []models.ServiceAuthTokenFields 17 result2 error 18 } 19 FindByLabelAndProviderStub func(label, provider string) (authToken models.ServiceAuthTokenFields, apiErr error) 20 findByLabelAndProviderMutex sync.RWMutex 21 findByLabelAndProviderArgsForCall []struct { 22 label string 23 provider string 24 } 25 findByLabelAndProviderReturns struct { 26 result1 models.ServiceAuthTokenFields 27 result2 error 28 } 29 CreateStub func(authToken models.ServiceAuthTokenFields) (apiErr error) 30 createMutex sync.RWMutex 31 createArgsForCall []struct { 32 authToken models.ServiceAuthTokenFields 33 } 34 createReturns struct { 35 result1 error 36 } 37 UpdateStub func(authToken models.ServiceAuthTokenFields) (apiErr error) 38 updateMutex sync.RWMutex 39 updateArgsForCall []struct { 40 authToken models.ServiceAuthTokenFields 41 } 42 updateReturns struct { 43 result1 error 44 } 45 DeleteStub func(authToken models.ServiceAuthTokenFields) (apiErr error) 46 deleteMutex sync.RWMutex 47 deleteArgsForCall []struct { 48 authToken models.ServiceAuthTokenFields 49 } 50 deleteReturns struct { 51 result1 error 52 } 53 invocations map[string][][]interface{} 54 invocationsMutex sync.RWMutex 55 } 56 57 func (fake *FakeServiceAuthTokenRepository) FindAll() (authTokens []models.ServiceAuthTokenFields, apiErr error) { 58 fake.findAllMutex.Lock() 59 fake.findAllArgsForCall = append(fake.findAllArgsForCall, struct{}{}) 60 fake.recordInvocation("FindAll", []interface{}{}) 61 fake.findAllMutex.Unlock() 62 if fake.FindAllStub != nil { 63 return fake.FindAllStub() 64 } else { 65 return fake.findAllReturns.result1, fake.findAllReturns.result2 66 } 67 } 68 69 func (fake *FakeServiceAuthTokenRepository) FindAllCallCount() int { 70 fake.findAllMutex.RLock() 71 defer fake.findAllMutex.RUnlock() 72 return len(fake.findAllArgsForCall) 73 } 74 75 func (fake *FakeServiceAuthTokenRepository) FindAllReturns(result1 []models.ServiceAuthTokenFields, result2 error) { 76 fake.FindAllStub = nil 77 fake.findAllReturns = struct { 78 result1 []models.ServiceAuthTokenFields 79 result2 error 80 }{result1, result2} 81 } 82 83 func (fake *FakeServiceAuthTokenRepository) FindByLabelAndProvider(label string, provider string) (authToken models.ServiceAuthTokenFields, apiErr error) { 84 fake.findByLabelAndProviderMutex.Lock() 85 fake.findByLabelAndProviderArgsForCall = append(fake.findByLabelAndProviderArgsForCall, struct { 86 label string 87 provider string 88 }{label, provider}) 89 fake.recordInvocation("FindByLabelAndProvider", []interface{}{label, provider}) 90 fake.findByLabelAndProviderMutex.Unlock() 91 if fake.FindByLabelAndProviderStub != nil { 92 return fake.FindByLabelAndProviderStub(label, provider) 93 } else { 94 return fake.findByLabelAndProviderReturns.result1, fake.findByLabelAndProviderReturns.result2 95 } 96 } 97 98 func (fake *FakeServiceAuthTokenRepository) FindByLabelAndProviderCallCount() int { 99 fake.findByLabelAndProviderMutex.RLock() 100 defer fake.findByLabelAndProviderMutex.RUnlock() 101 return len(fake.findByLabelAndProviderArgsForCall) 102 } 103 104 func (fake *FakeServiceAuthTokenRepository) FindByLabelAndProviderArgsForCall(i int) (string, string) { 105 fake.findByLabelAndProviderMutex.RLock() 106 defer fake.findByLabelAndProviderMutex.RUnlock() 107 return fake.findByLabelAndProviderArgsForCall[i].label, fake.findByLabelAndProviderArgsForCall[i].provider 108 } 109 110 func (fake *FakeServiceAuthTokenRepository) FindByLabelAndProviderReturns(result1 models.ServiceAuthTokenFields, result2 error) { 111 fake.FindByLabelAndProviderStub = nil 112 fake.findByLabelAndProviderReturns = struct { 113 result1 models.ServiceAuthTokenFields 114 result2 error 115 }{result1, result2} 116 } 117 118 func (fake *FakeServiceAuthTokenRepository) Create(authToken models.ServiceAuthTokenFields) (apiErr error) { 119 fake.createMutex.Lock() 120 fake.createArgsForCall = append(fake.createArgsForCall, struct { 121 authToken models.ServiceAuthTokenFields 122 }{authToken}) 123 fake.recordInvocation("Create", []interface{}{authToken}) 124 fake.createMutex.Unlock() 125 if fake.CreateStub != nil { 126 return fake.CreateStub(authToken) 127 } else { 128 return fake.createReturns.result1 129 } 130 } 131 132 func (fake *FakeServiceAuthTokenRepository) CreateCallCount() int { 133 fake.createMutex.RLock() 134 defer fake.createMutex.RUnlock() 135 return len(fake.createArgsForCall) 136 } 137 138 func (fake *FakeServiceAuthTokenRepository) CreateArgsForCall(i int) models.ServiceAuthTokenFields { 139 fake.createMutex.RLock() 140 defer fake.createMutex.RUnlock() 141 return fake.createArgsForCall[i].authToken 142 } 143 144 func (fake *FakeServiceAuthTokenRepository) CreateReturns(result1 error) { 145 fake.CreateStub = nil 146 fake.createReturns = struct { 147 result1 error 148 }{result1} 149 } 150 151 func (fake *FakeServiceAuthTokenRepository) Update(authToken models.ServiceAuthTokenFields) (apiErr error) { 152 fake.updateMutex.Lock() 153 fake.updateArgsForCall = append(fake.updateArgsForCall, struct { 154 authToken models.ServiceAuthTokenFields 155 }{authToken}) 156 fake.recordInvocation("Update", []interface{}{authToken}) 157 fake.updateMutex.Unlock() 158 if fake.UpdateStub != nil { 159 return fake.UpdateStub(authToken) 160 } else { 161 return fake.updateReturns.result1 162 } 163 } 164 165 func (fake *FakeServiceAuthTokenRepository) UpdateCallCount() int { 166 fake.updateMutex.RLock() 167 defer fake.updateMutex.RUnlock() 168 return len(fake.updateArgsForCall) 169 } 170 171 func (fake *FakeServiceAuthTokenRepository) UpdateArgsForCall(i int) models.ServiceAuthTokenFields { 172 fake.updateMutex.RLock() 173 defer fake.updateMutex.RUnlock() 174 return fake.updateArgsForCall[i].authToken 175 } 176 177 func (fake *FakeServiceAuthTokenRepository) UpdateReturns(result1 error) { 178 fake.UpdateStub = nil 179 fake.updateReturns = struct { 180 result1 error 181 }{result1} 182 } 183 184 func (fake *FakeServiceAuthTokenRepository) Delete(authToken models.ServiceAuthTokenFields) (apiErr error) { 185 fake.deleteMutex.Lock() 186 fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct { 187 authToken models.ServiceAuthTokenFields 188 }{authToken}) 189 fake.recordInvocation("Delete", []interface{}{authToken}) 190 fake.deleteMutex.Unlock() 191 if fake.DeleteStub != nil { 192 return fake.DeleteStub(authToken) 193 } else { 194 return fake.deleteReturns.result1 195 } 196 } 197 198 func (fake *FakeServiceAuthTokenRepository) DeleteCallCount() int { 199 fake.deleteMutex.RLock() 200 defer fake.deleteMutex.RUnlock() 201 return len(fake.deleteArgsForCall) 202 } 203 204 func (fake *FakeServiceAuthTokenRepository) DeleteArgsForCall(i int) models.ServiceAuthTokenFields { 205 fake.deleteMutex.RLock() 206 defer fake.deleteMutex.RUnlock() 207 return fake.deleteArgsForCall[i].authToken 208 } 209 210 func (fake *FakeServiceAuthTokenRepository) DeleteReturns(result1 error) { 211 fake.DeleteStub = nil 212 fake.deleteReturns = struct { 213 result1 error 214 }{result1} 215 } 216 217 func (fake *FakeServiceAuthTokenRepository) Invocations() map[string][][]interface{} { 218 fake.invocationsMutex.RLock() 219 defer fake.invocationsMutex.RUnlock() 220 fake.findAllMutex.RLock() 221 defer fake.findAllMutex.RUnlock() 222 fake.findByLabelAndProviderMutex.RLock() 223 defer fake.findByLabelAndProviderMutex.RUnlock() 224 fake.createMutex.RLock() 225 defer fake.createMutex.RUnlock() 226 fake.updateMutex.RLock() 227 defer fake.updateMutex.RUnlock() 228 fake.deleteMutex.RLock() 229 defer fake.deleteMutex.RUnlock() 230 return fake.invocations 231 } 232 233 func (fake *FakeServiceAuthTokenRepository) recordInvocation(key string, args []interface{}) { 234 fake.invocationsMutex.Lock() 235 defer fake.invocationsMutex.Unlock() 236 if fake.invocations == nil { 237 fake.invocations = map[string][][]interface{}{} 238 } 239 if fake.invocations[key] == nil { 240 fake.invocations[key] = [][]interface{}{} 241 } 242 fake.invocations[key] = append(fake.invocations[key], args) 243 } 244 245 var _ api.ServiceAuthTokenRepository = new(FakeServiceAuthTokenRepository)