github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/util/configv3/configv3fakes/fake_user_config.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package configv3fakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/util/configv3"
     8  )
     9  
    10  type FakeUserConfig struct {
    11  	CurrentUserStub        func() (configv3.User, error)
    12  	currentUserMutex       sync.RWMutex
    13  	currentUserArgsForCall []struct {
    14  	}
    15  	currentUserReturns struct {
    16  		result1 configv3.User
    17  		result2 error
    18  	}
    19  	currentUserReturnsOnCall map[int]struct {
    20  		result1 configv3.User
    21  		result2 error
    22  	}
    23  	CurrentUserNameStub        func() (string, error)
    24  	currentUserNameMutex       sync.RWMutex
    25  	currentUserNameArgsForCall []struct {
    26  	}
    27  	currentUserNameReturns struct {
    28  		result1 string
    29  		result2 error
    30  	}
    31  	currentUserNameReturnsOnCall map[int]struct {
    32  		result1 string
    33  		result2 error
    34  	}
    35  	invocations      map[string][][]interface{}
    36  	invocationsMutex sync.RWMutex
    37  }
    38  
    39  func (fake *FakeUserConfig) CurrentUser() (configv3.User, error) {
    40  	fake.currentUserMutex.Lock()
    41  	ret, specificReturn := fake.currentUserReturnsOnCall[len(fake.currentUserArgsForCall)]
    42  	fake.currentUserArgsForCall = append(fake.currentUserArgsForCall, struct {
    43  	}{})
    44  	fake.recordInvocation("CurrentUser", []interface{}{})
    45  	fake.currentUserMutex.Unlock()
    46  	if fake.CurrentUserStub != nil {
    47  		return fake.CurrentUserStub()
    48  	}
    49  	if specificReturn {
    50  		return ret.result1, ret.result2
    51  	}
    52  	fakeReturns := fake.currentUserReturns
    53  	return fakeReturns.result1, fakeReturns.result2
    54  }
    55  
    56  func (fake *FakeUserConfig) CurrentUserCallCount() int {
    57  	fake.currentUserMutex.RLock()
    58  	defer fake.currentUserMutex.RUnlock()
    59  	return len(fake.currentUserArgsForCall)
    60  }
    61  
    62  func (fake *FakeUserConfig) CurrentUserCalls(stub func() (configv3.User, error)) {
    63  	fake.currentUserMutex.Lock()
    64  	defer fake.currentUserMutex.Unlock()
    65  	fake.CurrentUserStub = stub
    66  }
    67  
    68  func (fake *FakeUserConfig) CurrentUserReturns(result1 configv3.User, result2 error) {
    69  	fake.currentUserMutex.Lock()
    70  	defer fake.currentUserMutex.Unlock()
    71  	fake.CurrentUserStub = nil
    72  	fake.currentUserReturns = struct {
    73  		result1 configv3.User
    74  		result2 error
    75  	}{result1, result2}
    76  }
    77  
    78  func (fake *FakeUserConfig) CurrentUserReturnsOnCall(i int, result1 configv3.User, result2 error) {
    79  	fake.currentUserMutex.Lock()
    80  	defer fake.currentUserMutex.Unlock()
    81  	fake.CurrentUserStub = nil
    82  	if fake.currentUserReturnsOnCall == nil {
    83  		fake.currentUserReturnsOnCall = make(map[int]struct {
    84  			result1 configv3.User
    85  			result2 error
    86  		})
    87  	}
    88  	fake.currentUserReturnsOnCall[i] = struct {
    89  		result1 configv3.User
    90  		result2 error
    91  	}{result1, result2}
    92  }
    93  
    94  func (fake *FakeUserConfig) CurrentUserName() (string, error) {
    95  	fake.currentUserNameMutex.Lock()
    96  	ret, specificReturn := fake.currentUserNameReturnsOnCall[len(fake.currentUserNameArgsForCall)]
    97  	fake.currentUserNameArgsForCall = append(fake.currentUserNameArgsForCall, struct {
    98  	}{})
    99  	fake.recordInvocation("CurrentUserName", []interface{}{})
   100  	fake.currentUserNameMutex.Unlock()
   101  	if fake.CurrentUserNameStub != nil {
   102  		return fake.CurrentUserNameStub()
   103  	}
   104  	if specificReturn {
   105  		return ret.result1, ret.result2
   106  	}
   107  	fakeReturns := fake.currentUserNameReturns
   108  	return fakeReturns.result1, fakeReturns.result2
   109  }
   110  
   111  func (fake *FakeUserConfig) CurrentUserNameCallCount() int {
   112  	fake.currentUserNameMutex.RLock()
   113  	defer fake.currentUserNameMutex.RUnlock()
   114  	return len(fake.currentUserNameArgsForCall)
   115  }
   116  
   117  func (fake *FakeUserConfig) CurrentUserNameCalls(stub func() (string, error)) {
   118  	fake.currentUserNameMutex.Lock()
   119  	defer fake.currentUserNameMutex.Unlock()
   120  	fake.CurrentUserNameStub = stub
   121  }
   122  
   123  func (fake *FakeUserConfig) CurrentUserNameReturns(result1 string, result2 error) {
   124  	fake.currentUserNameMutex.Lock()
   125  	defer fake.currentUserNameMutex.Unlock()
   126  	fake.CurrentUserNameStub = nil
   127  	fake.currentUserNameReturns = struct {
   128  		result1 string
   129  		result2 error
   130  	}{result1, result2}
   131  }
   132  
   133  func (fake *FakeUserConfig) CurrentUserNameReturnsOnCall(i int, result1 string, result2 error) {
   134  	fake.currentUserNameMutex.Lock()
   135  	defer fake.currentUserNameMutex.Unlock()
   136  	fake.CurrentUserNameStub = nil
   137  	if fake.currentUserNameReturnsOnCall == nil {
   138  		fake.currentUserNameReturnsOnCall = make(map[int]struct {
   139  			result1 string
   140  			result2 error
   141  		})
   142  	}
   143  	fake.currentUserNameReturnsOnCall[i] = struct {
   144  		result1 string
   145  		result2 error
   146  	}{result1, result2}
   147  }
   148  
   149  func (fake *FakeUserConfig) Invocations() map[string][][]interface{} {
   150  	fake.invocationsMutex.RLock()
   151  	defer fake.invocationsMutex.RUnlock()
   152  	fake.currentUserMutex.RLock()
   153  	defer fake.currentUserMutex.RUnlock()
   154  	fake.currentUserNameMutex.RLock()
   155  	defer fake.currentUserNameMutex.RUnlock()
   156  	copiedInvocations := map[string][][]interface{}{}
   157  	for key, value := range fake.invocations {
   158  		copiedInvocations[key] = value
   159  	}
   160  	return copiedInvocations
   161  }
   162  
   163  func (fake *FakeUserConfig) recordInvocation(key string, args []interface{}) {
   164  	fake.invocationsMutex.Lock()
   165  	defer fake.invocationsMutex.Unlock()
   166  	if fake.invocations == nil {
   167  		fake.invocations = map[string][][]interface{}{}
   168  	}
   169  	if fake.invocations[key] == nil {
   170  		fake.invocations[key] = [][]interface{}{}
   171  	}
   172  	fake.invocations[key] = append(fake.invocations[key], args)
   173  }
   174  
   175  var _ configv3.UserConfig = new(FakeUserConfig)