code.cloudfoundry.org/cli@v7.1.0+incompatible/cf/net/netfakes/fake_httpclient_interface.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package netfakes 3 4 import ( 5 "net/http" 6 "sync" 7 8 "code.cloudfoundry.org/cli/cf/net" 9 ) 10 11 type FakeHTTPClientInterface struct { 12 DoStub func(*http.Request) (*http.Response, error) 13 doMutex sync.RWMutex 14 doArgsForCall []struct { 15 arg1 *http.Request 16 } 17 doReturns struct { 18 result1 *http.Response 19 result2 error 20 } 21 doReturnsOnCall map[int]struct { 22 result1 *http.Response 23 result2 error 24 } 25 DumpRequestStub func(*http.Request) 26 dumpRequestMutex sync.RWMutex 27 dumpRequestArgsForCall []struct { 28 arg1 *http.Request 29 } 30 DumpResponseStub func(*http.Response) 31 dumpResponseMutex sync.RWMutex 32 dumpResponseArgsForCall []struct { 33 arg1 *http.Response 34 } 35 ExecuteCheckRedirectStub func(*http.Request, []*http.Request) error 36 executeCheckRedirectMutex sync.RWMutex 37 executeCheckRedirectArgsForCall []struct { 38 arg1 *http.Request 39 arg2 []*http.Request 40 } 41 executeCheckRedirectReturns struct { 42 result1 error 43 } 44 executeCheckRedirectReturnsOnCall map[int]struct { 45 result1 error 46 } 47 invocations map[string][][]interface{} 48 invocationsMutex sync.RWMutex 49 } 50 51 func (fake *FakeHTTPClientInterface) Do(arg1 *http.Request) (*http.Response, error) { 52 fake.doMutex.Lock() 53 ret, specificReturn := fake.doReturnsOnCall[len(fake.doArgsForCall)] 54 fake.doArgsForCall = append(fake.doArgsForCall, struct { 55 arg1 *http.Request 56 }{arg1}) 57 fake.recordInvocation("Do", []interface{}{arg1}) 58 fake.doMutex.Unlock() 59 if fake.DoStub != nil { 60 return fake.DoStub(arg1) 61 } 62 if specificReturn { 63 return ret.result1, ret.result2 64 } 65 fakeReturns := fake.doReturns 66 return fakeReturns.result1, fakeReturns.result2 67 } 68 69 func (fake *FakeHTTPClientInterface) DoCallCount() int { 70 fake.doMutex.RLock() 71 defer fake.doMutex.RUnlock() 72 return len(fake.doArgsForCall) 73 } 74 75 func (fake *FakeHTTPClientInterface) DoCalls(stub func(*http.Request) (*http.Response, error)) { 76 fake.doMutex.Lock() 77 defer fake.doMutex.Unlock() 78 fake.DoStub = stub 79 } 80 81 func (fake *FakeHTTPClientInterface) DoArgsForCall(i int) *http.Request { 82 fake.doMutex.RLock() 83 defer fake.doMutex.RUnlock() 84 argsForCall := fake.doArgsForCall[i] 85 return argsForCall.arg1 86 } 87 88 func (fake *FakeHTTPClientInterface) DoReturns(result1 *http.Response, result2 error) { 89 fake.doMutex.Lock() 90 defer fake.doMutex.Unlock() 91 fake.DoStub = nil 92 fake.doReturns = struct { 93 result1 *http.Response 94 result2 error 95 }{result1, result2} 96 } 97 98 func (fake *FakeHTTPClientInterface) DoReturnsOnCall(i int, result1 *http.Response, result2 error) { 99 fake.doMutex.Lock() 100 defer fake.doMutex.Unlock() 101 fake.DoStub = nil 102 if fake.doReturnsOnCall == nil { 103 fake.doReturnsOnCall = make(map[int]struct { 104 result1 *http.Response 105 result2 error 106 }) 107 } 108 fake.doReturnsOnCall[i] = struct { 109 result1 *http.Response 110 result2 error 111 }{result1, result2} 112 } 113 114 func (fake *FakeHTTPClientInterface) DumpRequest(arg1 *http.Request) { 115 fake.dumpRequestMutex.Lock() 116 fake.dumpRequestArgsForCall = append(fake.dumpRequestArgsForCall, struct { 117 arg1 *http.Request 118 }{arg1}) 119 fake.recordInvocation("DumpRequest", []interface{}{arg1}) 120 fake.dumpRequestMutex.Unlock() 121 if fake.DumpRequestStub != nil { 122 fake.DumpRequestStub(arg1) 123 } 124 } 125 126 func (fake *FakeHTTPClientInterface) DumpRequestCallCount() int { 127 fake.dumpRequestMutex.RLock() 128 defer fake.dumpRequestMutex.RUnlock() 129 return len(fake.dumpRequestArgsForCall) 130 } 131 132 func (fake *FakeHTTPClientInterface) DumpRequestCalls(stub func(*http.Request)) { 133 fake.dumpRequestMutex.Lock() 134 defer fake.dumpRequestMutex.Unlock() 135 fake.DumpRequestStub = stub 136 } 137 138 func (fake *FakeHTTPClientInterface) DumpRequestArgsForCall(i int) *http.Request { 139 fake.dumpRequestMutex.RLock() 140 defer fake.dumpRequestMutex.RUnlock() 141 argsForCall := fake.dumpRequestArgsForCall[i] 142 return argsForCall.arg1 143 } 144 145 func (fake *FakeHTTPClientInterface) DumpResponse(arg1 *http.Response) { 146 fake.dumpResponseMutex.Lock() 147 fake.dumpResponseArgsForCall = append(fake.dumpResponseArgsForCall, struct { 148 arg1 *http.Response 149 }{arg1}) 150 fake.recordInvocation("DumpResponse", []interface{}{arg1}) 151 fake.dumpResponseMutex.Unlock() 152 if fake.DumpResponseStub != nil { 153 fake.DumpResponseStub(arg1) 154 } 155 } 156 157 func (fake *FakeHTTPClientInterface) DumpResponseCallCount() int { 158 fake.dumpResponseMutex.RLock() 159 defer fake.dumpResponseMutex.RUnlock() 160 return len(fake.dumpResponseArgsForCall) 161 } 162 163 func (fake *FakeHTTPClientInterface) DumpResponseCalls(stub func(*http.Response)) { 164 fake.dumpResponseMutex.Lock() 165 defer fake.dumpResponseMutex.Unlock() 166 fake.DumpResponseStub = stub 167 } 168 169 func (fake *FakeHTTPClientInterface) DumpResponseArgsForCall(i int) *http.Response { 170 fake.dumpResponseMutex.RLock() 171 defer fake.dumpResponseMutex.RUnlock() 172 argsForCall := fake.dumpResponseArgsForCall[i] 173 return argsForCall.arg1 174 } 175 176 func (fake *FakeHTTPClientInterface) ExecuteCheckRedirect(arg1 *http.Request, arg2 []*http.Request) error { 177 var arg2Copy []*http.Request 178 if arg2 != nil { 179 arg2Copy = make([]*http.Request, len(arg2)) 180 copy(arg2Copy, arg2) 181 } 182 fake.executeCheckRedirectMutex.Lock() 183 ret, specificReturn := fake.executeCheckRedirectReturnsOnCall[len(fake.executeCheckRedirectArgsForCall)] 184 fake.executeCheckRedirectArgsForCall = append(fake.executeCheckRedirectArgsForCall, struct { 185 arg1 *http.Request 186 arg2 []*http.Request 187 }{arg1, arg2Copy}) 188 fake.recordInvocation("ExecuteCheckRedirect", []interface{}{arg1, arg2Copy}) 189 fake.executeCheckRedirectMutex.Unlock() 190 if fake.ExecuteCheckRedirectStub != nil { 191 return fake.ExecuteCheckRedirectStub(arg1, arg2) 192 } 193 if specificReturn { 194 return ret.result1 195 } 196 fakeReturns := fake.executeCheckRedirectReturns 197 return fakeReturns.result1 198 } 199 200 func (fake *FakeHTTPClientInterface) ExecuteCheckRedirectCallCount() int { 201 fake.executeCheckRedirectMutex.RLock() 202 defer fake.executeCheckRedirectMutex.RUnlock() 203 return len(fake.executeCheckRedirectArgsForCall) 204 } 205 206 func (fake *FakeHTTPClientInterface) ExecuteCheckRedirectCalls(stub func(*http.Request, []*http.Request) error) { 207 fake.executeCheckRedirectMutex.Lock() 208 defer fake.executeCheckRedirectMutex.Unlock() 209 fake.ExecuteCheckRedirectStub = stub 210 } 211 212 func (fake *FakeHTTPClientInterface) ExecuteCheckRedirectArgsForCall(i int) (*http.Request, []*http.Request) { 213 fake.executeCheckRedirectMutex.RLock() 214 defer fake.executeCheckRedirectMutex.RUnlock() 215 argsForCall := fake.executeCheckRedirectArgsForCall[i] 216 return argsForCall.arg1, argsForCall.arg2 217 } 218 219 func (fake *FakeHTTPClientInterface) ExecuteCheckRedirectReturns(result1 error) { 220 fake.executeCheckRedirectMutex.Lock() 221 defer fake.executeCheckRedirectMutex.Unlock() 222 fake.ExecuteCheckRedirectStub = nil 223 fake.executeCheckRedirectReturns = struct { 224 result1 error 225 }{result1} 226 } 227 228 func (fake *FakeHTTPClientInterface) ExecuteCheckRedirectReturnsOnCall(i int, result1 error) { 229 fake.executeCheckRedirectMutex.Lock() 230 defer fake.executeCheckRedirectMutex.Unlock() 231 fake.ExecuteCheckRedirectStub = nil 232 if fake.executeCheckRedirectReturnsOnCall == nil { 233 fake.executeCheckRedirectReturnsOnCall = make(map[int]struct { 234 result1 error 235 }) 236 } 237 fake.executeCheckRedirectReturnsOnCall[i] = struct { 238 result1 error 239 }{result1} 240 } 241 242 func (fake *FakeHTTPClientInterface) Invocations() map[string][][]interface{} { 243 fake.invocationsMutex.RLock() 244 defer fake.invocationsMutex.RUnlock() 245 fake.doMutex.RLock() 246 defer fake.doMutex.RUnlock() 247 fake.dumpRequestMutex.RLock() 248 defer fake.dumpRequestMutex.RUnlock() 249 fake.dumpResponseMutex.RLock() 250 defer fake.dumpResponseMutex.RUnlock() 251 fake.executeCheckRedirectMutex.RLock() 252 defer fake.executeCheckRedirectMutex.RUnlock() 253 copiedInvocations := map[string][][]interface{}{} 254 for key, value := range fake.invocations { 255 copiedInvocations[key] = value 256 } 257 return copiedInvocations 258 } 259 260 func (fake *FakeHTTPClientInterface) recordInvocation(key string, args []interface{}) { 261 fake.invocationsMutex.Lock() 262 defer fake.invocationsMutex.Unlock() 263 if fake.invocations == nil { 264 fake.invocations = map[string][][]interface{}{} 265 } 266 if fake.invocations[key] == nil { 267 fake.invocations[key] = [][]interface{}{} 268 } 269 fake.invocations[key] = append(fake.invocations[key], args) 270 } 271 272 var _ net.HTTPClientInterface = new(FakeHTTPClientInterface)