github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/uaa/uaafakes/fake_connection.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package uaafakes 3 4 import ( 5 "net/http" 6 "sync" 7 8 "code.cloudfoundry.org/cli/api/uaa" 9 ) 10 11 type FakeConnection struct { 12 MakeStub func(request *http.Request, passedResponse *uaa.Response) error 13 makeMutex sync.RWMutex 14 makeArgsForCall []struct { 15 request *http.Request 16 passedResponse *uaa.Response 17 } 18 makeReturns struct { 19 result1 error 20 } 21 makeReturnsOnCall map[int]struct { 22 result1 error 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *FakeConnection) Make(request *http.Request, passedResponse *uaa.Response) error { 29 fake.makeMutex.Lock() 30 ret, specificReturn := fake.makeReturnsOnCall[len(fake.makeArgsForCall)] 31 fake.makeArgsForCall = append(fake.makeArgsForCall, struct { 32 request *http.Request 33 passedResponse *uaa.Response 34 }{request, passedResponse}) 35 fake.recordInvocation("Make", []interface{}{request, passedResponse}) 36 fake.makeMutex.Unlock() 37 if fake.MakeStub != nil { 38 return fake.MakeStub(request, passedResponse) 39 } 40 if specificReturn { 41 return ret.result1 42 } 43 return fake.makeReturns.result1 44 } 45 46 func (fake *FakeConnection) MakeCallCount() int { 47 fake.makeMutex.RLock() 48 defer fake.makeMutex.RUnlock() 49 return len(fake.makeArgsForCall) 50 } 51 52 func (fake *FakeConnection) MakeArgsForCall(i int) (*http.Request, *uaa.Response) { 53 fake.makeMutex.RLock() 54 defer fake.makeMutex.RUnlock() 55 return fake.makeArgsForCall[i].request, fake.makeArgsForCall[i].passedResponse 56 } 57 58 func (fake *FakeConnection) MakeReturns(result1 error) { 59 fake.MakeStub = nil 60 fake.makeReturns = struct { 61 result1 error 62 }{result1} 63 } 64 65 func (fake *FakeConnection) MakeReturnsOnCall(i int, result1 error) { 66 fake.MakeStub = nil 67 if fake.makeReturnsOnCall == nil { 68 fake.makeReturnsOnCall = make(map[int]struct { 69 result1 error 70 }) 71 } 72 fake.makeReturnsOnCall[i] = struct { 73 result1 error 74 }{result1} 75 } 76 77 func (fake *FakeConnection) Invocations() map[string][][]interface{} { 78 fake.invocationsMutex.RLock() 79 defer fake.invocationsMutex.RUnlock() 80 fake.makeMutex.RLock() 81 defer fake.makeMutex.RUnlock() 82 copiedInvocations := map[string][][]interface{}{} 83 for key, value := range fake.invocations { 84 copiedInvocations[key] = value 85 } 86 return copiedInvocations 87 } 88 89 func (fake *FakeConnection) recordInvocation(key string, args []interface{}) { 90 fake.invocationsMutex.Lock() 91 defer fake.invocationsMutex.Unlock() 92 if fake.invocations == nil { 93 fake.invocations = map[string][][]interface{}{} 94 } 95 if fake.invocations[key] == nil { 96 fake.invocations[key] = [][]interface{}{} 97 } 98 fake.invocations[key] = append(fake.invocations[key], args) 99 } 100 101 var _ uaa.Connection = new(FakeConnection)