-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathTagRepo.go
More file actions
182 lines (157 loc) · 5.01 KB
/
Copy pathTagRepo.go
File metadata and controls
182 lines (157 loc) · 5.01 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
package mocks
import (
"context"
"github.com/bangumi/server/internal/model"
"github.com/bangumi/server/internal/tag"
mock "github.com/stretchr/testify/mock"
)
// NewTagRepo creates a new instance of TagRepo. 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 NewTagRepo(t interface {
mock.TestingT
Cleanup(func())
}) *TagRepo {
mock := &TagRepo{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// TagRepo is an autogenerated mock type for the Repo type
type TagRepo struct {
mock.Mock
}
type TagRepo_Expecter struct {
mock *mock.Mock
}
func (_m *TagRepo) EXPECT() *TagRepo_Expecter {
return &TagRepo_Expecter{mock: &_m.Mock}
}
// Get provides a mock function for the type TagRepo
func (_mock *TagRepo) Get(ctx context.Context, id model.SubjectID, typeID model.SubjectType) ([]tag.Tag, error) {
ret := _mock.Called(ctx, id, typeID)
if len(ret) == 0 {
panic("no return value specified for Get")
}
var r0 []tag.Tag
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, model.SubjectID, model.SubjectType) ([]tag.Tag, error)); ok {
return returnFunc(ctx, id, typeID)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, model.SubjectID, model.SubjectType) []tag.Tag); ok {
r0 = returnFunc(ctx, id, typeID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]tag.Tag)
}
}
if returnFunc, ok := ret.Get(1).(func(context.Context, model.SubjectID, model.SubjectType) error); ok {
r1 = returnFunc(ctx, id, typeID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TagRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
type TagRepo_Get_Call struct {
*mock.Call
}
// Get is a helper method to define mock.On call
// - ctx context.Context
// - id model.SubjectID
// - typeID model.SubjectType
func (_e *TagRepo_Expecter) Get(ctx interface{}, id interface{}, typeID interface{}) *TagRepo_Get_Call {
return &TagRepo_Get_Call{Call: _e.mock.On("Get", ctx, id, typeID)}
}
func (_c *TagRepo_Get_Call) Run(run func(ctx context.Context, id model.SubjectID, typeID model.SubjectType)) *TagRepo_Get_Call {
_c.Call.Run(func(args mock.Arguments) {
var arg0 context.Context
if args[0] != nil {
arg0 = args[0].(context.Context)
}
var arg1 model.SubjectID
if args[1] != nil {
arg1 = args[1].(model.SubjectID)
}
var arg2 model.SubjectType
if args[2] != nil {
arg2 = args[2].(model.SubjectType)
}
run(
arg0,
arg1,
arg2,
)
})
return _c
}
func (_c *TagRepo_Get_Call) Return(tags []tag.Tag, err error) *TagRepo_Get_Call {
_c.Call.Return(tags, err)
return _c
}
func (_c *TagRepo_Get_Call) RunAndReturn(run func(ctx context.Context, id model.SubjectID, typeID model.SubjectType) ([]tag.Tag, error)) *TagRepo_Get_Call {
_c.Call.Return(run)
return _c
}
// GetByIDs provides a mock function for the type TagRepo
func (_mock *TagRepo) GetByIDs(ctx context.Context, ids []model.SubjectID) (map[model.SubjectID][]tag.Tag, error) {
ret := _mock.Called(ctx, ids)
if len(ret) == 0 {
panic("no return value specified for GetByIDs")
}
var r0 map[model.SubjectID][]tag.Tag
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, []model.SubjectID) (map[model.SubjectID][]tag.Tag, error)); ok {
return returnFunc(ctx, ids)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, []model.SubjectID) map[model.SubjectID][]tag.Tag); ok {
r0 = returnFunc(ctx, ids)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[model.SubjectID][]tag.Tag)
}
}
if returnFunc, ok := ret.Get(1).(func(context.Context, []model.SubjectID) error); ok {
r1 = returnFunc(ctx, ids)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TagRepo_GetByIDs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByIDs'
type TagRepo_GetByIDs_Call struct {
*mock.Call
}
// GetByIDs is a helper method to define mock.On call
// - ctx context.Context
// - ids []model.SubjectID
func (_e *TagRepo_Expecter) GetByIDs(ctx interface{}, ids interface{}) *TagRepo_GetByIDs_Call {
return &TagRepo_GetByIDs_Call{Call: _e.mock.On("GetByIDs", ctx, ids)}
}
func (_c *TagRepo_GetByIDs_Call) Run(run func(ctx context.Context, ids []model.SubjectID)) *TagRepo_GetByIDs_Call {
_c.Call.Run(func(args mock.Arguments) {
var arg0 context.Context
if args[0] != nil {
arg0 = args[0].(context.Context)
}
var arg1 []model.SubjectID
if args[1] != nil {
arg1 = args[1].([]model.SubjectID)
}
run(
arg0,
arg1,
)
})
return _c
}
func (_c *TagRepo_GetByIDs_Call) Return(vToTags map[model.SubjectID][]tag.Tag, err error) *TagRepo_GetByIDs_Call {
_c.Call.Return(vToTags, err)
return _c
}
func (_c *TagRepo_GetByIDs_Call) RunAndReturn(run func(ctx context.Context, ids []model.SubjectID) (map[model.SubjectID][]tag.Tag, error)) *TagRepo_GetByIDs_Call {
_c.Call.Return(run)
return _c
}