github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/authentication/authenticationfakes/fake_repository.go (about)

     1  // This file was generated by counterfeiter
     2  package authenticationfakes
     3  
     4  import (
     5  	"net/http"
     6  	"sync"
     7  
     8  	"code.cloudfoundry.org/cli/cf/api/authentication"
     9  	"code.cloudfoundry.org/cli/cf/configuration/coreconfig"
    10  )
    11  
    12  type FakeRepository struct {
    13  	DumpRequestStub        func(*http.Request)
    14  	dumpRequestMutex       sync.RWMutex
    15  	dumpRequestArgsForCall []struct {
    16  		arg1 *http.Request
    17  	}
    18  	DumpResponseStub        func(*http.Response)
    19  	dumpResponseMutex       sync.RWMutex
    20  	dumpResponseArgsForCall []struct {
    21  		arg1 *http.Response
    22  	}
    23  	RefreshAuthTokenStub        func() (updatedToken string, apiErr error)
    24  	refreshAuthTokenMutex       sync.RWMutex
    25  	refreshAuthTokenArgsForCall []struct{}
    26  	refreshAuthTokenReturns     struct {
    27  		result1 string
    28  		result2 error
    29  	}
    30  	AuthenticateStub        func(credentials map[string]string) (apiErr error)
    31  	authenticateMutex       sync.RWMutex
    32  	authenticateArgsForCall []struct {
    33  		credentials map[string]string
    34  	}
    35  	authenticateReturns struct {
    36  		result1 error
    37  	}
    38  	AuthorizeStub        func(token string) (string, error)
    39  	authorizeMutex       sync.RWMutex
    40  	authorizeArgsForCall []struct {
    41  		token string
    42  	}
    43  	authorizeReturns struct {
    44  		result1 string
    45  		result2 error
    46  	}
    47  	GetLoginPromptsAndSaveUAAServerURLStub        func() (map[string]coreconfig.AuthPrompt, error)
    48  	getLoginPromptsAndSaveUAAServerURLMutex       sync.RWMutex
    49  	getLoginPromptsAndSaveUAAServerURLArgsForCall []struct{}
    50  	getLoginPromptsAndSaveUAAServerURLReturns     struct {
    51  		result1 map[string]coreconfig.AuthPrompt
    52  		result2 error
    53  	}
    54  	invocations      map[string][][]interface{}
    55  	invocationsMutex sync.RWMutex
    56  }
    57  
    58  func (fake *FakeRepository) DumpRequest(arg1 *http.Request) {
    59  	fake.dumpRequestMutex.Lock()
    60  	fake.dumpRequestArgsForCall = append(fake.dumpRequestArgsForCall, struct {
    61  		arg1 *http.Request
    62  	}{arg1})
    63  	fake.recordInvocation("DumpRequest", []interface{}{arg1})
    64  	fake.dumpRequestMutex.Unlock()
    65  	if fake.DumpRequestStub != nil {
    66  		fake.DumpRequestStub(arg1)
    67  	}
    68  }
    69  
    70  func (fake *FakeRepository) DumpRequestCallCount() int {
    71  	fake.dumpRequestMutex.RLock()
    72  	defer fake.dumpRequestMutex.RUnlock()
    73  	return len(fake.dumpRequestArgsForCall)
    74  }
    75  
    76  func (fake *FakeRepository) DumpRequestArgsForCall(i int) *http.Request {
    77  	fake.dumpRequestMutex.RLock()
    78  	defer fake.dumpRequestMutex.RUnlock()
    79  	return fake.dumpRequestArgsForCall[i].arg1
    80  }
    81  
    82  func (fake *FakeRepository) DumpResponse(arg1 *http.Response) {
    83  	fake.dumpResponseMutex.Lock()
    84  	fake.dumpResponseArgsForCall = append(fake.dumpResponseArgsForCall, struct {
    85  		arg1 *http.Response
    86  	}{arg1})
    87  	fake.recordInvocation("DumpResponse", []interface{}{arg1})
    88  	fake.dumpResponseMutex.Unlock()
    89  	if fake.DumpResponseStub != nil {
    90  		fake.DumpResponseStub(arg1)
    91  	}
    92  }
    93  
    94  func (fake *FakeRepository) DumpResponseCallCount() int {
    95  	fake.dumpResponseMutex.RLock()
    96  	defer fake.dumpResponseMutex.RUnlock()
    97  	return len(fake.dumpResponseArgsForCall)
    98  }
    99  
   100  func (fake *FakeRepository) DumpResponseArgsForCall(i int) *http.Response {
   101  	fake.dumpResponseMutex.RLock()
   102  	defer fake.dumpResponseMutex.RUnlock()
   103  	return fake.dumpResponseArgsForCall[i].arg1
   104  }
   105  
   106  func (fake *FakeRepository) RefreshAuthToken() (updatedToken string, apiErr error) {
   107  	fake.refreshAuthTokenMutex.Lock()
   108  	fake.refreshAuthTokenArgsForCall = append(fake.refreshAuthTokenArgsForCall, struct{}{})
   109  	fake.recordInvocation("RefreshAuthToken", []interface{}{})
   110  	fake.refreshAuthTokenMutex.Unlock()
   111  	if fake.RefreshAuthTokenStub != nil {
   112  		return fake.RefreshAuthTokenStub()
   113  	} else {
   114  		return fake.refreshAuthTokenReturns.result1, fake.refreshAuthTokenReturns.result2
   115  	}
   116  }
   117  
   118  func (fake *FakeRepository) RefreshAuthTokenCallCount() int {
   119  	fake.refreshAuthTokenMutex.RLock()
   120  	defer fake.refreshAuthTokenMutex.RUnlock()
   121  	return len(fake.refreshAuthTokenArgsForCall)
   122  }
   123  
   124  func (fake *FakeRepository) RefreshAuthTokenReturns(result1 string, result2 error) {
   125  	fake.RefreshAuthTokenStub = nil
   126  	fake.refreshAuthTokenReturns = struct {
   127  		result1 string
   128  		result2 error
   129  	}{result1, result2}
   130  }
   131  
   132  func (fake *FakeRepository) Authenticate(credentials map[string]string) (apiErr error) {
   133  	fake.authenticateMutex.Lock()
   134  	fake.authenticateArgsForCall = append(fake.authenticateArgsForCall, struct {
   135  		credentials map[string]string
   136  	}{credentials})
   137  	fake.recordInvocation("Authenticate", []interface{}{credentials})
   138  	fake.authenticateMutex.Unlock()
   139  	if fake.AuthenticateStub != nil {
   140  		return fake.AuthenticateStub(credentials)
   141  	} else {
   142  		return fake.authenticateReturns.result1
   143  	}
   144  }
   145  
   146  func (fake *FakeRepository) AuthenticateCallCount() int {
   147  	fake.authenticateMutex.RLock()
   148  	defer fake.authenticateMutex.RUnlock()
   149  	return len(fake.authenticateArgsForCall)
   150  }
   151  
   152  func (fake *FakeRepository) AuthenticateArgsForCall(i int) map[string]string {
   153  	fake.authenticateMutex.RLock()
   154  	defer fake.authenticateMutex.RUnlock()
   155  	return fake.authenticateArgsForCall[i].credentials
   156  }
   157  
   158  func (fake *FakeRepository) AuthenticateReturns(result1 error) {
   159  	fake.AuthenticateStub = nil
   160  	fake.authenticateReturns = struct {
   161  		result1 error
   162  	}{result1}
   163  }
   164  
   165  func (fake *FakeRepository) Authorize(token string) (string, error) {
   166  	fake.authorizeMutex.Lock()
   167  	fake.authorizeArgsForCall = append(fake.authorizeArgsForCall, struct {
   168  		token string
   169  	}{token})
   170  	fake.recordInvocation("Authorize", []interface{}{token})
   171  	fake.authorizeMutex.Unlock()
   172  	if fake.AuthorizeStub != nil {
   173  		return fake.AuthorizeStub(token)
   174  	} else {
   175  		return fake.authorizeReturns.result1, fake.authorizeReturns.result2
   176  	}
   177  }
   178  
   179  func (fake *FakeRepository) AuthorizeCallCount() int {
   180  	fake.authorizeMutex.RLock()
   181  	defer fake.authorizeMutex.RUnlock()
   182  	return len(fake.authorizeArgsForCall)
   183  }
   184  
   185  func (fake *FakeRepository) AuthorizeArgsForCall(i int) string {
   186  	fake.authorizeMutex.RLock()
   187  	defer fake.authorizeMutex.RUnlock()
   188  	return fake.authorizeArgsForCall[i].token
   189  }
   190  
   191  func (fake *FakeRepository) AuthorizeReturns(result1 string, result2 error) {
   192  	fake.AuthorizeStub = nil
   193  	fake.authorizeReturns = struct {
   194  		result1 string
   195  		result2 error
   196  	}{result1, result2}
   197  }
   198  
   199  func (fake *FakeRepository) GetLoginPromptsAndSaveUAAServerURL() (map[string]coreconfig.AuthPrompt, error) {
   200  	fake.getLoginPromptsAndSaveUAAServerURLMutex.Lock()
   201  	fake.getLoginPromptsAndSaveUAAServerURLArgsForCall = append(fake.getLoginPromptsAndSaveUAAServerURLArgsForCall, struct{}{})
   202  	fake.recordInvocation("GetLoginPromptsAndSaveUAAServerURL", []interface{}{})
   203  	fake.getLoginPromptsAndSaveUAAServerURLMutex.Unlock()
   204  	if fake.GetLoginPromptsAndSaveUAAServerURLStub != nil {
   205  		return fake.GetLoginPromptsAndSaveUAAServerURLStub()
   206  	} else {
   207  		return fake.getLoginPromptsAndSaveUAAServerURLReturns.result1, fake.getLoginPromptsAndSaveUAAServerURLReturns.result2
   208  	}
   209  }
   210  
   211  func (fake *FakeRepository) GetLoginPromptsAndSaveUAAServerURLCallCount() int {
   212  	fake.getLoginPromptsAndSaveUAAServerURLMutex.RLock()
   213  	defer fake.getLoginPromptsAndSaveUAAServerURLMutex.RUnlock()
   214  	return len(fake.getLoginPromptsAndSaveUAAServerURLArgsForCall)
   215  }
   216  
   217  func (fake *FakeRepository) GetLoginPromptsAndSaveUAAServerURLReturns(result1 map[string]coreconfig.AuthPrompt, result2 error) {
   218  	fake.GetLoginPromptsAndSaveUAAServerURLStub = nil
   219  	fake.getLoginPromptsAndSaveUAAServerURLReturns = struct {
   220  		result1 map[string]coreconfig.AuthPrompt
   221  		result2 error
   222  	}{result1, result2}
   223  }
   224  
   225  func (fake *FakeRepository) Invocations() map[string][][]interface{} {
   226  	fake.invocationsMutex.RLock()
   227  	defer fake.invocationsMutex.RUnlock()
   228  	fake.dumpRequestMutex.RLock()
   229  	defer fake.dumpRequestMutex.RUnlock()
   230  	fake.dumpResponseMutex.RLock()
   231  	defer fake.dumpResponseMutex.RUnlock()
   232  	fake.refreshAuthTokenMutex.RLock()
   233  	defer fake.refreshAuthTokenMutex.RUnlock()
   234  	fake.authenticateMutex.RLock()
   235  	defer fake.authenticateMutex.RUnlock()
   236  	fake.authorizeMutex.RLock()
   237  	defer fake.authorizeMutex.RUnlock()
   238  	fake.getLoginPromptsAndSaveUAAServerURLMutex.RLock()
   239  	defer fake.getLoginPromptsAndSaveUAAServerURLMutex.RUnlock()
   240  	return fake.invocations
   241  }
   242  
   243  func (fake *FakeRepository) recordInvocation(key string, args []interface{}) {
   244  	fake.invocationsMutex.Lock()
   245  	defer fake.invocationsMutex.Unlock()
   246  	if fake.invocations == nil {
   247  		fake.invocations = map[string][][]interface{}{}
   248  	}
   249  	if fake.invocations[key] == nil {
   250  		fake.invocations[key] = [][]interface{}{}
   251  	}
   252  	fake.invocations[key] = append(fake.invocations[key], args)
   253  }
   254  
   255  var _ authentication.Repository = new(FakeRepository)