github.com/livekit/protocol@v1.16.1-0.20240517185851-47e4c6bba773/auth/authfakes/fake_key_provider.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 FakeKeyProvider struct {
    11  	GetSecretStub        func(string) string
    12  	getSecretMutex       sync.RWMutex
    13  	getSecretArgsForCall []struct {
    14  		arg1 string
    15  	}
    16  	getSecretReturns struct {
    17  		result1 string
    18  	}
    19  	getSecretReturnsOnCall map[int]struct {
    20  		result1 string
    21  	}
    22  	NumKeysStub        func() int
    23  	numKeysMutex       sync.RWMutex
    24  	numKeysArgsForCall []struct {
    25  	}
    26  	numKeysReturns struct {
    27  		result1 int
    28  	}
    29  	numKeysReturnsOnCall map[int]struct {
    30  		result1 int
    31  	}
    32  	invocations      map[string][][]interface{}
    33  	invocationsMutex sync.RWMutex
    34  }
    35  
    36  func (fake *FakeKeyProvider) GetSecret(arg1 string) string {
    37  	fake.getSecretMutex.Lock()
    38  	ret, specificReturn := fake.getSecretReturnsOnCall[len(fake.getSecretArgsForCall)]
    39  	fake.getSecretArgsForCall = append(fake.getSecretArgsForCall, struct {
    40  		arg1 string
    41  	}{arg1})
    42  	stub := fake.GetSecretStub
    43  	fakeReturns := fake.getSecretReturns
    44  	fake.recordInvocation("GetSecret", []interface{}{arg1})
    45  	fake.getSecretMutex.Unlock()
    46  	if stub != nil {
    47  		return stub(arg1)
    48  	}
    49  	if specificReturn {
    50  		return ret.result1
    51  	}
    52  	return fakeReturns.result1
    53  }
    54  
    55  func (fake *FakeKeyProvider) GetSecretCallCount() int {
    56  	fake.getSecretMutex.RLock()
    57  	defer fake.getSecretMutex.RUnlock()
    58  	return len(fake.getSecretArgsForCall)
    59  }
    60  
    61  func (fake *FakeKeyProvider) GetSecretCalls(stub func(string) string) {
    62  	fake.getSecretMutex.Lock()
    63  	defer fake.getSecretMutex.Unlock()
    64  	fake.GetSecretStub = stub
    65  }
    66  
    67  func (fake *FakeKeyProvider) GetSecretArgsForCall(i int) string {
    68  	fake.getSecretMutex.RLock()
    69  	defer fake.getSecretMutex.RUnlock()
    70  	argsForCall := fake.getSecretArgsForCall[i]
    71  	return argsForCall.arg1
    72  }
    73  
    74  func (fake *FakeKeyProvider) GetSecretReturns(result1 string) {
    75  	fake.getSecretMutex.Lock()
    76  	defer fake.getSecretMutex.Unlock()
    77  	fake.GetSecretStub = nil
    78  	fake.getSecretReturns = struct {
    79  		result1 string
    80  	}{result1}
    81  }
    82  
    83  func (fake *FakeKeyProvider) GetSecretReturnsOnCall(i int, result1 string) {
    84  	fake.getSecretMutex.Lock()
    85  	defer fake.getSecretMutex.Unlock()
    86  	fake.GetSecretStub = nil
    87  	if fake.getSecretReturnsOnCall == nil {
    88  		fake.getSecretReturnsOnCall = make(map[int]struct {
    89  			result1 string
    90  		})
    91  	}
    92  	fake.getSecretReturnsOnCall[i] = struct {
    93  		result1 string
    94  	}{result1}
    95  }
    96  
    97  func (fake *FakeKeyProvider) NumKeys() int {
    98  	fake.numKeysMutex.Lock()
    99  	ret, specificReturn := fake.numKeysReturnsOnCall[len(fake.numKeysArgsForCall)]
   100  	fake.numKeysArgsForCall = append(fake.numKeysArgsForCall, struct {
   101  	}{})
   102  	stub := fake.NumKeysStub
   103  	fakeReturns := fake.numKeysReturns
   104  	fake.recordInvocation("NumKeys", []interface{}{})
   105  	fake.numKeysMutex.Unlock()
   106  	if stub != nil {
   107  		return stub()
   108  	}
   109  	if specificReturn {
   110  		return ret.result1
   111  	}
   112  	return fakeReturns.result1
   113  }
   114  
   115  func (fake *FakeKeyProvider) NumKeysCallCount() int {
   116  	fake.numKeysMutex.RLock()
   117  	defer fake.numKeysMutex.RUnlock()
   118  	return len(fake.numKeysArgsForCall)
   119  }
   120  
   121  func (fake *FakeKeyProvider) NumKeysCalls(stub func() int) {
   122  	fake.numKeysMutex.Lock()
   123  	defer fake.numKeysMutex.Unlock()
   124  	fake.NumKeysStub = stub
   125  }
   126  
   127  func (fake *FakeKeyProvider) NumKeysReturns(result1 int) {
   128  	fake.numKeysMutex.Lock()
   129  	defer fake.numKeysMutex.Unlock()
   130  	fake.NumKeysStub = nil
   131  	fake.numKeysReturns = struct {
   132  		result1 int
   133  	}{result1}
   134  }
   135  
   136  func (fake *FakeKeyProvider) NumKeysReturnsOnCall(i int, result1 int) {
   137  	fake.numKeysMutex.Lock()
   138  	defer fake.numKeysMutex.Unlock()
   139  	fake.NumKeysStub = nil
   140  	if fake.numKeysReturnsOnCall == nil {
   141  		fake.numKeysReturnsOnCall = make(map[int]struct {
   142  			result1 int
   143  		})
   144  	}
   145  	fake.numKeysReturnsOnCall[i] = struct {
   146  		result1 int
   147  	}{result1}
   148  }
   149  
   150  func (fake *FakeKeyProvider) Invocations() map[string][][]interface{} {
   151  	fake.invocationsMutex.RLock()
   152  	defer fake.invocationsMutex.RUnlock()
   153  	fake.getSecretMutex.RLock()
   154  	defer fake.getSecretMutex.RUnlock()
   155  	fake.numKeysMutex.RLock()
   156  	defer fake.numKeysMutex.RUnlock()
   157  	copiedInvocations := map[string][][]interface{}{}
   158  	for key, value := range fake.invocations {
   159  		copiedInvocations[key] = value
   160  	}
   161  	return copiedInvocations
   162  }
   163  
   164  func (fake *FakeKeyProvider) recordInvocation(key string, args []interface{}) {
   165  	fake.invocationsMutex.Lock()
   166  	defer fake.invocationsMutex.Unlock()
   167  	if fake.invocations == nil {
   168  		fake.invocations = map[string][][]interface{}{}
   169  	}
   170  	if fake.invocations[key] == nil {
   171  		fake.invocations[key] = [][]interface{}{}
   172  	}
   173  	fake.invocations[key] = append(fake.invocations[key], args)
   174  }
   175  
   176  var _ auth.KeyProvider = new(FakeKeyProvider)