github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/apifakes/fake_curl_repository.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package apifakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api" 8 ) 9 10 type FakeCurlRepository struct { 11 RequestStub func(string, string, string, string, bool) (string, string, error) 12 requestMutex sync.RWMutex 13 requestArgsForCall []struct { 14 arg1 string 15 arg2 string 16 arg3 string 17 arg4 string 18 arg5 bool 19 } 20 requestReturns struct { 21 result1 string 22 result2 string 23 result3 error 24 } 25 requestReturnsOnCall map[int]struct { 26 result1 string 27 result2 string 28 result3 error 29 } 30 invocations map[string][][]interface{} 31 invocationsMutex sync.RWMutex 32 } 33 34 func (fake *FakeCurlRepository) Request(arg1 string, arg2 string, arg3 string, arg4 string, arg5 bool) (string, string, error) { 35 fake.requestMutex.Lock() 36 ret, specificReturn := fake.requestReturnsOnCall[len(fake.requestArgsForCall)] 37 fake.requestArgsForCall = append(fake.requestArgsForCall, struct { 38 arg1 string 39 arg2 string 40 arg3 string 41 arg4 string 42 arg5 bool 43 }{arg1, arg2, arg3, arg4, arg5}) 44 fake.recordInvocation("Request", []interface{}{arg1, arg2, arg3, arg4, arg5}) 45 fake.requestMutex.Unlock() 46 if fake.RequestStub != nil { 47 return fake.RequestStub(arg1, arg2, arg3, arg4, arg5) 48 } 49 if specificReturn { 50 return ret.result1, ret.result2, ret.result3 51 } 52 fakeReturns := fake.requestReturns 53 return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 54 } 55 56 func (fake *FakeCurlRepository) RequestCallCount() int { 57 fake.requestMutex.RLock() 58 defer fake.requestMutex.RUnlock() 59 return len(fake.requestArgsForCall) 60 } 61 62 func (fake *FakeCurlRepository) RequestCalls(stub func(string, string, string, string, bool) (string, string, error)) { 63 fake.requestMutex.Lock() 64 defer fake.requestMutex.Unlock() 65 fake.RequestStub = stub 66 } 67 68 func (fake *FakeCurlRepository) RequestArgsForCall(i int) (string, string, string, string, bool) { 69 fake.requestMutex.RLock() 70 defer fake.requestMutex.RUnlock() 71 argsForCall := fake.requestArgsForCall[i] 72 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5 73 } 74 75 func (fake *FakeCurlRepository) RequestReturns(result1 string, result2 string, result3 error) { 76 fake.requestMutex.Lock() 77 defer fake.requestMutex.Unlock() 78 fake.RequestStub = nil 79 fake.requestReturns = struct { 80 result1 string 81 result2 string 82 result3 error 83 }{result1, result2, result3} 84 } 85 86 func (fake *FakeCurlRepository) RequestReturnsOnCall(i int, result1 string, result2 string, result3 error) { 87 fake.requestMutex.Lock() 88 defer fake.requestMutex.Unlock() 89 fake.RequestStub = nil 90 if fake.requestReturnsOnCall == nil { 91 fake.requestReturnsOnCall = make(map[int]struct { 92 result1 string 93 result2 string 94 result3 error 95 }) 96 } 97 fake.requestReturnsOnCall[i] = struct { 98 result1 string 99 result2 string 100 result3 error 101 }{result1, result2, result3} 102 } 103 104 func (fake *FakeCurlRepository) Invocations() map[string][][]interface{} { 105 fake.invocationsMutex.RLock() 106 defer fake.invocationsMutex.RUnlock() 107 fake.requestMutex.RLock() 108 defer fake.requestMutex.RUnlock() 109 copiedInvocations := map[string][][]interface{}{} 110 for key, value := range fake.invocations { 111 copiedInvocations[key] = value 112 } 113 return copiedInvocations 114 } 115 116 func (fake *FakeCurlRepository) recordInvocation(key string, args []interface{}) { 117 fake.invocationsMutex.Lock() 118 defer fake.invocationsMutex.Unlock() 119 if fake.invocations == nil { 120 fake.invocations = map[string][][]interface{}{} 121 } 122 if fake.invocations[key] == nil { 123 fake.invocations[key] = [][]interface{}{} 124 } 125 fake.invocations[key] = append(fake.invocations[key], args) 126 } 127 128 var _ api.CurlRepository = new(FakeCurlRepository)