Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
PIP-1490: Simplify mocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Baliedge committed Jan 24, 2022
1 parent 87ce6e2 commit 1adaf52
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
10 changes: 2 additions & 8 deletions mock_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,13 @@ func (m *MockCache) UpdateExpiration(key string, expireAt int64) bool {

func (m *MockCache) GetItem(key string) (value *guber.CacheItem, ok bool) {
args := m.Called(key)
var retval *guber.CacheItem
if retval2, ok := args.Get(0).(*guber.CacheItem); ok {
retval = retval2
}
retval, _ := args.Get(0).(*guber.CacheItem)
return retval, args.Bool(1)
}

func (m *MockCache) Each() chan *guber.CacheItem {
args := m.Called()
var retval chan *guber.CacheItem
if retval2, ok := args.Get(0).(chan *guber.CacheItem); ok {
retval = retval2
}
retval, _ := args.Get(0).(chan *guber.CacheItem)
return retval
}

Expand Down
5 changes: 1 addition & 4 deletions mock_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ var _ guber.Loader = &MockLoader2{}

func (m *MockLoader2) Load() (chan *guber.CacheItem, error) {
args := m.Called()
var retval chan *guber.CacheItem
if retval2, ok := args.Get(0).(chan *guber.CacheItem); ok {
retval = retval2
}
retval := args.Get(0).(chan *guber.CacheItem)
return retval, args.Error(1)
}

Expand Down
5 changes: 1 addition & 4 deletions mock_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ func (m *MockStore2) OnChange(ctx context.Context, r *guber.RateLimitReq, item *

func (m *MockStore2) Get(ctx context.Context, r *guber.RateLimitReq) (*guber.CacheItem, bool) {
args := m.Called(ctx, r)
var retval *guber.CacheItem
if retval2, ok := args.Get(0).(*guber.CacheItem); ok {
retval = retval2
}
retval, _ := args.Get(0).(*guber.CacheItem)
return retval, args.Bool(1)
}

Expand Down

0 comments on commit 1adaf52

Please sign in to comment.