github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/auditor/auditorfakes/fake_auditor.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package auditorfakes 3 4 import ( 5 "net/http" 6 "sync" 7 8 "github.com/pf-qiu/concourse/v6/atc/auditor" 9 ) 10 11 type FakeAuditor struct { 12 AuditStub func(string, string, *http.Request) 13 auditMutex sync.RWMutex 14 auditArgsForCall []struct { 15 arg1 string 16 arg2 string 17 arg3 *http.Request 18 } 19 invocations map[string][][]interface{} 20 invocationsMutex sync.RWMutex 21 } 22 23 func (fake *FakeAuditor) Audit(arg1 string, arg2 string, arg3 *http.Request) { 24 fake.auditMutex.Lock() 25 fake.auditArgsForCall = append(fake.auditArgsForCall, struct { 26 arg1 string 27 arg2 string 28 arg3 *http.Request 29 }{arg1, arg2, arg3}) 30 fake.recordInvocation("Audit", []interface{}{arg1, arg2, arg3}) 31 fake.auditMutex.Unlock() 32 if fake.AuditStub != nil { 33 fake.AuditStub(arg1, arg2, arg3) 34 } 35 } 36 37 func (fake *FakeAuditor) AuditCallCount() int { 38 fake.auditMutex.RLock() 39 defer fake.auditMutex.RUnlock() 40 return len(fake.auditArgsForCall) 41 } 42 43 func (fake *FakeAuditor) AuditCalls(stub func(string, string, *http.Request)) { 44 fake.auditMutex.Lock() 45 defer fake.auditMutex.Unlock() 46 fake.AuditStub = stub 47 } 48 49 func (fake *FakeAuditor) AuditArgsForCall(i int) (string, string, *http.Request) { 50 fake.auditMutex.RLock() 51 defer fake.auditMutex.RUnlock() 52 argsForCall := fake.auditArgsForCall[i] 53 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 54 } 55 56 func (fake *FakeAuditor) Invocations() map[string][][]interface{} { 57 fake.invocationsMutex.RLock() 58 defer fake.invocationsMutex.RUnlock() 59 fake.auditMutex.RLock() 60 defer fake.auditMutex.RUnlock() 61 copiedInvocations := map[string][][]interface{}{} 62 for key, value := range fake.invocations { 63 copiedInvocations[key] = value 64 } 65 return copiedInvocations 66 } 67 68 func (fake *FakeAuditor) recordInvocation(key string, args []interface{}) { 69 fake.invocationsMutex.Lock() 70 defer fake.invocationsMutex.Unlock() 71 if fake.invocations == nil { 72 fake.invocations = map[string][][]interface{}{} 73 } 74 if fake.invocations[key] == nil { 75 fake.invocations[key] = [][]interface{}{} 76 } 77 fake.invocations[key] = append(fake.invocations[key], args) 78 } 79 80 var _ auditor.Auditor = new(FakeAuditor)