github.com/DelineaXPM/dsv-cli@v1.40.6/tests/fake/fake_graph_client.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package fake
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/DelineaXPM/dsv-cli/errors"
     8  	"github.com/DelineaXPM/dsv-cli/requests"
     9  )
    10  
    11  type FakeGraphClient struct {
    12  	DoRequestStub        func(string, interface{}, map[string]interface{}) ([]byte, *errors.ApiError)
    13  	doRequestMutex       sync.RWMutex
    14  	doRequestArgsForCall []struct {
    15  		arg1 string
    16  		arg2 interface{}
    17  		arg3 map[string]interface{}
    18  	}
    19  	doRequestReturns struct {
    20  		result1 []byte
    21  		result2 *errors.ApiError
    22  	}
    23  	doRequestReturnsOnCall map[int]struct {
    24  		result1 []byte
    25  		result2 *errors.ApiError
    26  	}
    27  	invocations      map[string][][]interface{}
    28  	invocationsMutex sync.RWMutex
    29  }
    30  
    31  func (fake *FakeGraphClient) DoRequest(arg1 string, arg2 interface{}, arg3 map[string]interface{}) ([]byte, *errors.ApiError) {
    32  	fake.doRequestMutex.Lock()
    33  	ret, specificReturn := fake.doRequestReturnsOnCall[len(fake.doRequestArgsForCall)]
    34  	fake.doRequestArgsForCall = append(fake.doRequestArgsForCall, struct {
    35  		arg1 string
    36  		arg2 interface{}
    37  		arg3 map[string]interface{}
    38  	}{arg1, arg2, arg3})
    39  	stub := fake.DoRequestStub
    40  	fakeReturns := fake.doRequestReturns
    41  	fake.recordInvocation("DoRequest", []interface{}{arg1, arg2, arg3})
    42  	fake.doRequestMutex.Unlock()
    43  	if stub != nil {
    44  		return stub(arg1, arg2, arg3)
    45  	}
    46  	if specificReturn {
    47  		return ret.result1, ret.result2
    48  	}
    49  	return fakeReturns.result1, fakeReturns.result2
    50  }
    51  
    52  func (fake *FakeGraphClient) DoRequestCallCount() int {
    53  	fake.doRequestMutex.RLock()
    54  	defer fake.doRequestMutex.RUnlock()
    55  	return len(fake.doRequestArgsForCall)
    56  }
    57  
    58  func (fake *FakeGraphClient) DoRequestCalls(stub func(string, interface{}, map[string]interface{}) ([]byte, *errors.ApiError)) {
    59  	fake.doRequestMutex.Lock()
    60  	defer fake.doRequestMutex.Unlock()
    61  	fake.DoRequestStub = stub
    62  }
    63  
    64  func (fake *FakeGraphClient) DoRequestArgsForCall(i int) (string, interface{}, map[string]interface{}) {
    65  	fake.doRequestMutex.RLock()
    66  	defer fake.doRequestMutex.RUnlock()
    67  	argsForCall := fake.doRequestArgsForCall[i]
    68  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    69  }
    70  
    71  func (fake *FakeGraphClient) DoRequestReturns(result1 []byte, result2 *errors.ApiError) {
    72  	fake.doRequestMutex.Lock()
    73  	defer fake.doRequestMutex.Unlock()
    74  	fake.DoRequestStub = nil
    75  	fake.doRequestReturns = struct {
    76  		result1 []byte
    77  		result2 *errors.ApiError
    78  	}{result1, result2}
    79  }
    80  
    81  func (fake *FakeGraphClient) DoRequestReturnsOnCall(i int, result1 []byte, result2 *errors.ApiError) {
    82  	fake.doRequestMutex.Lock()
    83  	defer fake.doRequestMutex.Unlock()
    84  	fake.DoRequestStub = nil
    85  	if fake.doRequestReturnsOnCall == nil {
    86  		fake.doRequestReturnsOnCall = make(map[int]struct {
    87  			result1 []byte
    88  			result2 *errors.ApiError
    89  		})
    90  	}
    91  	fake.doRequestReturnsOnCall[i] = struct {
    92  		result1 []byte
    93  		result2 *errors.ApiError
    94  	}{result1, result2}
    95  }
    96  
    97  func (fake *FakeGraphClient) Invocations() map[string][][]interface{} {
    98  	fake.invocationsMutex.RLock()
    99  	defer fake.invocationsMutex.RUnlock()
   100  	fake.doRequestMutex.RLock()
   101  	defer fake.doRequestMutex.RUnlock()
   102  	copiedInvocations := map[string][][]interface{}{}
   103  	for key, value := range fake.invocations {
   104  		copiedInvocations[key] = value
   105  	}
   106  	return copiedInvocations
   107  }
   108  
   109  func (fake *FakeGraphClient) recordInvocation(key string, args []interface{}) {
   110  	fake.invocationsMutex.Lock()
   111  	defer fake.invocationsMutex.Unlock()
   112  	if fake.invocations == nil {
   113  		fake.invocations = map[string][][]interface{}{}
   114  	}
   115  	if fake.invocations[key] == nil {
   116  		fake.invocations[key] = [][]interface{}{}
   117  	}
   118  	fake.invocations[key] = append(fake.invocations[key], args)
   119  }
   120  
   121  var _ requests.GraphClient = new(FakeGraphClient)