/
Store_mock.go
136 lines (109 loc) · 3.66 KB
/
Store_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
types "github.com/jdiuwe/api-server-demo/types"
)
// MockStore is an autogenerated mock type for the Store type
type MockStore struct {
mock.Mock
}
type MockStore_Expecter struct {
mock *mock.Mock
}
func (_m *MockStore) EXPECT() *MockStore_Expecter {
return &MockStore_Expecter{mock: &_m.Mock}
}
// CreateUser provides a mock function with given fields: ctx, user
func (_m *MockStore) CreateUser(ctx context.Context, user *types.User) error {
ret := _m.Called(ctx, user)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.User) error); ok {
r0 = rf(ctx, user)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockStore_CreateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUser'
type MockStore_CreateUser_Call struct {
*mock.Call
}
// CreateUser is a helper method to define mock.On call
// - ctx context.Context
// - user *types.User
func (_e *MockStore_Expecter) CreateUser(ctx interface{}, user interface{}) *MockStore_CreateUser_Call {
return &MockStore_CreateUser_Call{Call: _e.mock.On("CreateUser", ctx, user)}
}
func (_c *MockStore_CreateUser_Call) Run(run func(ctx context.Context, user *types.User)) *MockStore_CreateUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*types.User))
})
return _c
}
func (_c *MockStore_CreateUser_Call) Return(_a0 error) *MockStore_CreateUser_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockStore_CreateUser_Call) RunAndReturn(run func(context.Context, *types.User) error) *MockStore_CreateUser_Call {
_c.Call.Return(run)
return _c
}
// GetUser provides a mock function with given fields: ctx, id
func (_m *MockStore) GetUser(ctx context.Context, id string) (*types.User, error) {
ret := _m.Called(ctx, id)
var r0 *types.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (*types.User, error)); ok {
return rf(ctx, id)
}
if rf, ok := ret.Get(0).(func(context.Context, string) *types.User); ok {
r0 = rf(ctx, id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(ctx, id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockStore_GetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUser'
type MockStore_GetUser_Call struct {
*mock.Call
}
// GetUser is a helper method to define mock.On call
// - ctx context.Context
// - id string
func (_e *MockStore_Expecter) GetUser(ctx interface{}, id interface{}) *MockStore_GetUser_Call {
return &MockStore_GetUser_Call{Call: _e.mock.On("GetUser", ctx, id)}
}
func (_c *MockStore_GetUser_Call) Run(run func(ctx context.Context, id string)) *MockStore_GetUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockStore_GetUser_Call) Return(_a0 *types.User, _a1 error) *MockStore_GetUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockStore_GetUser_Call) RunAndReturn(run func(context.Context, string) (*types.User, error)) *MockStore_GetUser_Call {
_c.Call.Return(run)
return _c
}
// NewMockStore creates a new instance of MockStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockStore(t interface {
mock.TestingT
Cleanup(func())
}) *MockStore {
mock := &MockStore{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}