github.com/livekit/protocol@v1.16.1-0.20240517185851-47e4c6bba773/auth/authfakes/fake_token_verifier.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package authfakes 3 4 import ( 5 "sync" 6 7 "github.com/livekit/protocol/auth" 8 ) 9 10 type FakeTokenVerifier struct { 11 IdentityStub func() string 12 identityMutex sync.RWMutex 13 identityArgsForCall []struct { 14 } 15 identityReturns struct { 16 result1 string 17 } 18 identityReturnsOnCall map[int]struct { 19 result1 string 20 } 21 VerifyStub func(interface{}) (*auth.ClaimGrants, error) 22 verifyMutex sync.RWMutex 23 verifyArgsForCall []struct { 24 arg1 interface{} 25 } 26 verifyReturns struct { 27 result1 *auth.ClaimGrants 28 result2 error 29 } 30 verifyReturnsOnCall map[int]struct { 31 result1 *auth.ClaimGrants 32 result2 error 33 } 34 invocations map[string][][]interface{} 35 invocationsMutex sync.RWMutex 36 } 37 38 func (fake *FakeTokenVerifier) Identity() string { 39 fake.identityMutex.Lock() 40 ret, specificReturn := fake.identityReturnsOnCall[len(fake.identityArgsForCall)] 41 fake.identityArgsForCall = append(fake.identityArgsForCall, struct { 42 }{}) 43 stub := fake.IdentityStub 44 fakeReturns := fake.identityReturns 45 fake.recordInvocation("Identity", []interface{}{}) 46 fake.identityMutex.Unlock() 47 if stub != nil { 48 return stub() 49 } 50 if specificReturn { 51 return ret.result1 52 } 53 return fakeReturns.result1 54 } 55 56 func (fake *FakeTokenVerifier) IdentityCallCount() int { 57 fake.identityMutex.RLock() 58 defer fake.identityMutex.RUnlock() 59 return len(fake.identityArgsForCall) 60 } 61 62 func (fake *FakeTokenVerifier) IdentityCalls(stub func() string) { 63 fake.identityMutex.Lock() 64 defer fake.identityMutex.Unlock() 65 fake.IdentityStub = stub 66 } 67 68 func (fake *FakeTokenVerifier) IdentityReturns(result1 string) { 69 fake.identityMutex.Lock() 70 defer fake.identityMutex.Unlock() 71 fake.IdentityStub = nil 72 fake.identityReturns = struct { 73 result1 string 74 }{result1} 75 } 76 77 func (fake *FakeTokenVerifier) IdentityReturnsOnCall(i int, result1 string) { 78 fake.identityMutex.Lock() 79 defer fake.identityMutex.Unlock() 80 fake.IdentityStub = nil 81 if fake.identityReturnsOnCall == nil { 82 fake.identityReturnsOnCall = make(map[int]struct { 83 result1 string 84 }) 85 } 86 fake.identityReturnsOnCall[i] = struct { 87 result1 string 88 }{result1} 89 } 90 91 func (fake *FakeTokenVerifier) Verify(arg1 interface{}) (*auth.ClaimGrants, error) { 92 fake.verifyMutex.Lock() 93 ret, specificReturn := fake.verifyReturnsOnCall[len(fake.verifyArgsForCall)] 94 fake.verifyArgsForCall = append(fake.verifyArgsForCall, struct { 95 arg1 interface{} 96 }{arg1}) 97 stub := fake.VerifyStub 98 fakeReturns := fake.verifyReturns 99 fake.recordInvocation("Verify", []interface{}{arg1}) 100 fake.verifyMutex.Unlock() 101 if stub != nil { 102 return stub(arg1) 103 } 104 if specificReturn { 105 return ret.result1, ret.result2 106 } 107 return fakeReturns.result1, fakeReturns.result2 108 } 109 110 func (fake *FakeTokenVerifier) VerifyCallCount() int { 111 fake.verifyMutex.RLock() 112 defer fake.verifyMutex.RUnlock() 113 return len(fake.verifyArgsForCall) 114 } 115 116 func (fake *FakeTokenVerifier) VerifyCalls(stub func(interface{}) (*auth.ClaimGrants, error)) { 117 fake.verifyMutex.Lock() 118 defer fake.verifyMutex.Unlock() 119 fake.VerifyStub = stub 120 } 121 122 func (fake *FakeTokenVerifier) VerifyArgsForCall(i int) interface{} { 123 fake.verifyMutex.RLock() 124 defer fake.verifyMutex.RUnlock() 125 argsForCall := fake.verifyArgsForCall[i] 126 return argsForCall.arg1 127 } 128 129 func (fake *FakeTokenVerifier) VerifyReturns(result1 *auth.ClaimGrants, result2 error) { 130 fake.verifyMutex.Lock() 131 defer fake.verifyMutex.Unlock() 132 fake.VerifyStub = nil 133 fake.verifyReturns = struct { 134 result1 *auth.ClaimGrants 135 result2 error 136 }{result1, result2} 137 } 138 139 func (fake *FakeTokenVerifier) VerifyReturnsOnCall(i int, result1 *auth.ClaimGrants, result2 error) { 140 fake.verifyMutex.Lock() 141 defer fake.verifyMutex.Unlock() 142 fake.VerifyStub = nil 143 if fake.verifyReturnsOnCall == nil { 144 fake.verifyReturnsOnCall = make(map[int]struct { 145 result1 *auth.ClaimGrants 146 result2 error 147 }) 148 } 149 fake.verifyReturnsOnCall[i] = struct { 150 result1 *auth.ClaimGrants 151 result2 error 152 }{result1, result2} 153 } 154 155 func (fake *FakeTokenVerifier) Invocations() map[string][][]interface{} { 156 fake.invocationsMutex.RLock() 157 defer fake.invocationsMutex.RUnlock() 158 fake.identityMutex.RLock() 159 defer fake.identityMutex.RUnlock() 160 fake.verifyMutex.RLock() 161 defer fake.verifyMutex.RUnlock() 162 copiedInvocations := map[string][][]interface{}{} 163 for key, value := range fake.invocations { 164 copiedInvocations[key] = value 165 } 166 return copiedInvocations 167 } 168 169 func (fake *FakeTokenVerifier) recordInvocation(key string, args []interface{}) { 170 fake.invocationsMutex.Lock() 171 defer fake.invocationsMutex.Unlock() 172 if fake.invocations == nil { 173 fake.invocations = map[string][][]interface{}{} 174 } 175 if fake.invocations[key] == nil { 176 fake.invocations[key] = [][]interface{}{} 177 } 178 fake.invocations[key] = append(fake.invocations[key], args) 179 } 180 181 var _ auth.TokenVerifier = new(FakeTokenVerifier)