github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/api/auth/authfakes/fake_rejector.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package authfakes
     3  
     4  import (
     5  	"net/http"
     6  	"sync"
     7  
     8  	"github.com/pf-qiu/concourse/v6/atc/api/auth"
     9  )
    10  
    11  type FakeRejector struct {
    12  	ForbiddenStub        func(http.ResponseWriter, *http.Request)
    13  	forbiddenMutex       sync.RWMutex
    14  	forbiddenArgsForCall []struct {
    15  		arg1 http.ResponseWriter
    16  		arg2 *http.Request
    17  	}
    18  	UnauthorizedStub        func(http.ResponseWriter, *http.Request)
    19  	unauthorizedMutex       sync.RWMutex
    20  	unauthorizedArgsForCall []struct {
    21  		arg1 http.ResponseWriter
    22  		arg2 *http.Request
    23  	}
    24  	invocations      map[string][][]interface{}
    25  	invocationsMutex sync.RWMutex
    26  }
    27  
    28  func (fake *FakeRejector) Forbidden(arg1 http.ResponseWriter, arg2 *http.Request) {
    29  	fake.forbiddenMutex.Lock()
    30  	fake.forbiddenArgsForCall = append(fake.forbiddenArgsForCall, struct {
    31  		arg1 http.ResponseWriter
    32  		arg2 *http.Request
    33  	}{arg1, arg2})
    34  	fake.recordInvocation("Forbidden", []interface{}{arg1, arg2})
    35  	fake.forbiddenMutex.Unlock()
    36  	if fake.ForbiddenStub != nil {
    37  		fake.ForbiddenStub(arg1, arg2)
    38  	}
    39  }
    40  
    41  func (fake *FakeRejector) ForbiddenCallCount() int {
    42  	fake.forbiddenMutex.RLock()
    43  	defer fake.forbiddenMutex.RUnlock()
    44  	return len(fake.forbiddenArgsForCall)
    45  }
    46  
    47  func (fake *FakeRejector) ForbiddenCalls(stub func(http.ResponseWriter, *http.Request)) {
    48  	fake.forbiddenMutex.Lock()
    49  	defer fake.forbiddenMutex.Unlock()
    50  	fake.ForbiddenStub = stub
    51  }
    52  
    53  func (fake *FakeRejector) ForbiddenArgsForCall(i int) (http.ResponseWriter, *http.Request) {
    54  	fake.forbiddenMutex.RLock()
    55  	defer fake.forbiddenMutex.RUnlock()
    56  	argsForCall := fake.forbiddenArgsForCall[i]
    57  	return argsForCall.arg1, argsForCall.arg2
    58  }
    59  
    60  func (fake *FakeRejector) Unauthorized(arg1 http.ResponseWriter, arg2 *http.Request) {
    61  	fake.unauthorizedMutex.Lock()
    62  	fake.unauthorizedArgsForCall = append(fake.unauthorizedArgsForCall, struct {
    63  		arg1 http.ResponseWriter
    64  		arg2 *http.Request
    65  	}{arg1, arg2})
    66  	fake.recordInvocation("Unauthorized", []interface{}{arg1, arg2})
    67  	fake.unauthorizedMutex.Unlock()
    68  	if fake.UnauthorizedStub != nil {
    69  		fake.UnauthorizedStub(arg1, arg2)
    70  	}
    71  }
    72  
    73  func (fake *FakeRejector) UnauthorizedCallCount() int {
    74  	fake.unauthorizedMutex.RLock()
    75  	defer fake.unauthorizedMutex.RUnlock()
    76  	return len(fake.unauthorizedArgsForCall)
    77  }
    78  
    79  func (fake *FakeRejector) UnauthorizedCalls(stub func(http.ResponseWriter, *http.Request)) {
    80  	fake.unauthorizedMutex.Lock()
    81  	defer fake.unauthorizedMutex.Unlock()
    82  	fake.UnauthorizedStub = stub
    83  }
    84  
    85  func (fake *FakeRejector) UnauthorizedArgsForCall(i int) (http.ResponseWriter, *http.Request) {
    86  	fake.unauthorizedMutex.RLock()
    87  	defer fake.unauthorizedMutex.RUnlock()
    88  	argsForCall := fake.unauthorizedArgsForCall[i]
    89  	return argsForCall.arg1, argsForCall.arg2
    90  }
    91  
    92  func (fake *FakeRejector) Invocations() map[string][][]interface{} {
    93  	fake.invocationsMutex.RLock()
    94  	defer fake.invocationsMutex.RUnlock()
    95  	fake.forbiddenMutex.RLock()
    96  	defer fake.forbiddenMutex.RUnlock()
    97  	fake.unauthorizedMutex.RLock()
    98  	defer fake.unauthorizedMutex.RUnlock()
    99  	copiedInvocations := map[string][][]interface{}{}
   100  	for key, value := range fake.invocations {
   101  		copiedInvocations[key] = value
   102  	}
   103  	return copiedInvocations
   104  }
   105  
   106  func (fake *FakeRejector) recordInvocation(key string, args []interface{}) {
   107  	fake.invocationsMutex.Lock()
   108  	defer fake.invocationsMutex.Unlock()
   109  	if fake.invocations == nil {
   110  		fake.invocations = map[string][][]interface{}{}
   111  	}
   112  	if fake.invocations[key] == nil {
   113  		fake.invocations[key] = [][]interface{}{}
   114  	}
   115  	fake.invocations[key] = append(fake.invocations[key], args)
   116  }
   117  
   118  var _ auth.Rejector = new(FakeRejector)