github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/cf/api/password/passwordfakes/fake_repository.go (about)

     1  // This file was generated by counterfeiter
     2  package passwordfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/api/password"
     8  	. "code.cloudfoundry.org/cli/cf/i18n"
     9  )
    10  
    11  type FakeRepository struct {
    12  	UpdatePasswordStub        func(old string, new string) error
    13  	updatePasswordMutex       sync.RWMutex
    14  	updatePasswordArgsForCall []struct {
    15  		old string
    16  		new string
    17  	}
    18  	updatePasswordReturns struct {
    19  		result1 error
    20  	}
    21  	invocations      map[string][][]interface{}
    22  	invocationsMutex sync.RWMutex
    23  }
    24  
    25  func (fake *FakeRepository) UpdatePassword(old string, new string) error {
    26  	fake.updatePasswordMutex.Lock()
    27  	fake.updatePasswordArgsForCall = append(fake.updatePasswordArgsForCall, struct {
    28  		old string
    29  		new string
    30  	}{old, new})
    31  	fake.recordInvocation("UpdatePassword", []interface{}{old, new})
    32  	fake.updatePasswordMutex.Unlock()
    33  	if fake.UpdatePasswordStub != nil {
    34  		return fake.UpdatePasswordStub(old, new)
    35  	} else {
    36  		return fake.updatePasswordReturns.result1
    37  	}
    38  }
    39  
    40  func (fake *FakeRepository) UpdatePasswordCallCount() int {
    41  	fake.updatePasswordMutex.RLock()
    42  	defer fake.updatePasswordMutex.RUnlock()
    43  	return len(fake.updatePasswordArgsForCall)
    44  }
    45  
    46  func (fake *FakeRepository) UpdatePasswordArgsForCall(i int) (string, string) {
    47  	fake.updatePasswordMutex.RLock()
    48  	defer fake.updatePasswordMutex.RUnlock()
    49  	return fake.updatePasswordArgsForCall[i].old, fake.updatePasswordArgsForCall[i].new
    50  }
    51  
    52  func (fake *FakeRepository) UpdatePasswordReturns(result1 error) {
    53  	fake.UpdatePasswordStub = nil
    54  	fake.updatePasswordReturns = struct {
    55  		result1 error
    56  	}{result1}
    57  }
    58  
    59  func (fake *FakeRepository) Invocations() map[string][][]interface{} {
    60  	fake.invocationsMutex.RLock()
    61  	defer fake.invocationsMutex.RUnlock()
    62  	fake.updatePasswordMutex.RLock()
    63  	defer fake.updatePasswordMutex.RUnlock()
    64  	return fake.invocations
    65  }
    66  
    67  func (fake *FakeRepository) recordInvocation(key string, args []interface{}) {
    68  	fake.invocationsMutex.Lock()
    69  	defer fake.invocationsMutex.Unlock()
    70  	if fake.invocations == nil {
    71  		fake.invocations = map[string][][]interface{}{}
    72  	}
    73  	if fake.invocations[key] == nil {
    74  		fake.invocations[key] = [][]interface{}{}
    75  	}
    76  	fake.invocations[key] = append(fake.invocations[key], args)
    77  }
    78  
    79  var _ password.Repository = new(FakeRepository)