github.com/ablease/cli@v6.37.1-0.20180613014814-3adbb7d7fb19+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  )
     9  
    10  type FakeRepository struct {
    11  	UpdatePasswordStub        func(old string, new string) error
    12  	updatePasswordMutex       sync.RWMutex
    13  	updatePasswordArgsForCall []struct {
    14  		old string
    15  		new string
    16  	}
    17  	updatePasswordReturns struct {
    18  		result1 error
    19  	}
    20  	invocations      map[string][][]interface{}
    21  	invocationsMutex sync.RWMutex
    22  }
    23  
    24  func (fake *FakeRepository) UpdatePassword(old string, new string) error {
    25  	fake.updatePasswordMutex.Lock()
    26  	fake.updatePasswordArgsForCall = append(fake.updatePasswordArgsForCall, struct {
    27  		old string
    28  		new string
    29  	}{old, new})
    30  	fake.recordInvocation("UpdatePassword", []interface{}{old, new})
    31  	fake.updatePasswordMutex.Unlock()
    32  	if fake.UpdatePasswordStub != nil {
    33  		return fake.UpdatePasswordStub(old, new)
    34  	} else {
    35  		return fake.updatePasswordReturns.result1
    36  	}
    37  }
    38  
    39  func (fake *FakeRepository) UpdatePasswordCallCount() int {
    40  	fake.updatePasswordMutex.RLock()
    41  	defer fake.updatePasswordMutex.RUnlock()
    42  	return len(fake.updatePasswordArgsForCall)
    43  }
    44  
    45  func (fake *FakeRepository) UpdatePasswordArgsForCall(i int) (string, string) {
    46  	fake.updatePasswordMutex.RLock()
    47  	defer fake.updatePasswordMutex.RUnlock()
    48  	return fake.updatePasswordArgsForCall[i].old, fake.updatePasswordArgsForCall[i].new
    49  }
    50  
    51  func (fake *FakeRepository) UpdatePasswordReturns(result1 error) {
    52  	fake.UpdatePasswordStub = nil
    53  	fake.updatePasswordReturns = struct {
    54  		result1 error
    55  	}{result1}
    56  }
    57  
    58  func (fake *FakeRepository) Invocations() map[string][][]interface{} {
    59  	fake.invocationsMutex.RLock()
    60  	defer fake.invocationsMutex.RUnlock()
    61  	fake.updatePasswordMutex.RLock()
    62  	defer fake.updatePasswordMutex.RUnlock()
    63  	return fake.invocations
    64  }
    65  
    66  func (fake *FakeRepository) recordInvocation(key string, args []interface{}) {
    67  	fake.invocationsMutex.Lock()
    68  	defer fake.invocationsMutex.Unlock()
    69  	if fake.invocations == nil {
    70  		fake.invocations = map[string][][]interface{}{}
    71  	}
    72  	if fake.invocations[key] == nil {
    73  		fake.invocations[key] = [][]interface{}{}
    74  	}
    75  	fake.invocations[key] = append(fake.invocations[key], args)
    76  }
    77  
    78  var _ password.Repository = new(FakeRepository)