github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/shared/sharedfakes/fake_round_tripper.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package sharedfakes
     3  
     4  import (
     5  	"net/http"
     6  	"sync"
     7  )
     8  
     9  type FakeRoundTripper struct {
    10  	RoundTripStub        func(*http.Request) (*http.Response, error)
    11  	roundTripMutex       sync.RWMutex
    12  	roundTripArgsForCall []struct {
    13  		arg1 *http.Request
    14  	}
    15  	roundTripReturns struct {
    16  		result1 *http.Response
    17  		result2 error
    18  	}
    19  	roundTripReturnsOnCall map[int]struct {
    20  		result1 *http.Response
    21  		result2 error
    22  	}
    23  	invocations      map[string][][]interface{}
    24  	invocationsMutex sync.RWMutex
    25  }
    26  
    27  func (fake *FakeRoundTripper) RoundTrip(arg1 *http.Request) (*http.Response, error) {
    28  	fake.roundTripMutex.Lock()
    29  	ret, specificReturn := fake.roundTripReturnsOnCall[len(fake.roundTripArgsForCall)]
    30  	fake.roundTripArgsForCall = append(fake.roundTripArgsForCall, struct {
    31  		arg1 *http.Request
    32  	}{arg1})
    33  	fake.recordInvocation("RoundTrip", []interface{}{arg1})
    34  	fake.roundTripMutex.Unlock()
    35  	if fake.RoundTripStub != nil {
    36  		return fake.RoundTripStub(arg1)
    37  	}
    38  	if specificReturn {
    39  		return ret.result1, ret.result2
    40  	}
    41  	fakeReturns := fake.roundTripReturns
    42  	return fakeReturns.result1, fakeReturns.result2
    43  }
    44  
    45  func (fake *FakeRoundTripper) RoundTripCallCount() int {
    46  	fake.roundTripMutex.RLock()
    47  	defer fake.roundTripMutex.RUnlock()
    48  	return len(fake.roundTripArgsForCall)
    49  }
    50  
    51  func (fake *FakeRoundTripper) RoundTripCalls(stub func(*http.Request) (*http.Response, error)) {
    52  	fake.roundTripMutex.Lock()
    53  	defer fake.roundTripMutex.Unlock()
    54  	fake.RoundTripStub = stub
    55  }
    56  
    57  func (fake *FakeRoundTripper) RoundTripArgsForCall(i int) *http.Request {
    58  	fake.roundTripMutex.RLock()
    59  	defer fake.roundTripMutex.RUnlock()
    60  	argsForCall := fake.roundTripArgsForCall[i]
    61  	return argsForCall.arg1
    62  }
    63  
    64  func (fake *FakeRoundTripper) RoundTripReturns(result1 *http.Response, result2 error) {
    65  	fake.roundTripMutex.Lock()
    66  	defer fake.roundTripMutex.Unlock()
    67  	fake.RoundTripStub = nil
    68  	fake.roundTripReturns = struct {
    69  		result1 *http.Response
    70  		result2 error
    71  	}{result1, result2}
    72  }
    73  
    74  func (fake *FakeRoundTripper) RoundTripReturnsOnCall(i int, result1 *http.Response, result2 error) {
    75  	fake.roundTripMutex.Lock()
    76  	defer fake.roundTripMutex.Unlock()
    77  	fake.RoundTripStub = nil
    78  	if fake.roundTripReturnsOnCall == nil {
    79  		fake.roundTripReturnsOnCall = make(map[int]struct {
    80  			result1 *http.Response
    81  			result2 error
    82  		})
    83  	}
    84  	fake.roundTripReturnsOnCall[i] = struct {
    85  		result1 *http.Response
    86  		result2 error
    87  	}{result1, result2}
    88  }
    89  
    90  func (fake *FakeRoundTripper) Invocations() map[string][][]interface{} {
    91  	fake.invocationsMutex.RLock()
    92  	defer fake.invocationsMutex.RUnlock()
    93  	fake.roundTripMutex.RLock()
    94  	defer fake.roundTripMutex.RUnlock()
    95  	copiedInvocations := map[string][][]interface{}{}
    96  	for key, value := range fake.invocations {
    97  		copiedInvocations[key] = value
    98  	}
    99  	return copiedInvocations
   100  }
   101  
   102  func (fake *FakeRoundTripper) recordInvocation(key string, args []interface{}) {
   103  	fake.invocationsMutex.Lock()
   104  	defer fake.invocationsMutex.Unlock()
   105  	if fake.invocations == nil {
   106  		fake.invocations = map[string][][]interface{}{}
   107  	}
   108  	if fake.invocations[key] == nil {
   109  		fake.invocations[key] = [][]interface{}{}
   110  	}
   111  	fake.invocations[key] = append(fake.invocations[key], args)
   112  }
   113  
   114  var _ http.RoundTripper = new(FakeRoundTripper)