mock_directory_manager_test.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. // Code generated by mockery; DO NOT EDIT.
  2. // github.com/vektra/mockery
  3. // template: testify
  4. package http
  5. import (
  6. "context"
  7. "github.com/mk6i/open-oscar-server/state"
  8. mock "github.com/stretchr/testify/mock"
  9. )
  10. // newMockDirectoryManager creates a new instance of mockDirectoryManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
  11. // The first argument is typically a *testing.T value.
  12. func newMockDirectoryManager(t interface {
  13. mock.TestingT
  14. Cleanup(func())
  15. }) *mockDirectoryManager {
  16. if helper, ok := t.(interface{ Helper() }); ok {
  17. helper.Helper()
  18. }
  19. mock := &mockDirectoryManager{}
  20. mock.Mock.Test(t)
  21. t.Cleanup(func() {
  22. if helper, ok := t.(interface{ Helper() }); ok {
  23. helper.Helper()
  24. }
  25. mock.AssertExpectations(t)
  26. })
  27. return mock
  28. }
  29. // mockDirectoryManager is an autogenerated mock type for the DirectoryManager type
  30. type mockDirectoryManager struct {
  31. mock.Mock
  32. }
  33. type mockDirectoryManager_Expecter struct {
  34. mock *mock.Mock
  35. }
  36. func (_m *mockDirectoryManager) EXPECT() *mockDirectoryManager_Expecter {
  37. return &mockDirectoryManager_Expecter{mock: &_m.Mock}
  38. }
  39. // Categories provides a mock function for the type mockDirectoryManager
  40. func (_mock *mockDirectoryManager) Categories(ctx context.Context) ([]state.Category, error) {
  41. ret := _mock.Called(ctx)
  42. if len(ret) == 0 {
  43. panic("no return value specified for Categories")
  44. }
  45. var r0 []state.Category
  46. var r1 error
  47. if returnFunc, ok := ret.Get(0).(func(context.Context) ([]state.Category, error)); ok {
  48. return returnFunc(ctx)
  49. }
  50. if returnFunc, ok := ret.Get(0).(func(context.Context) []state.Category); ok {
  51. r0 = returnFunc(ctx)
  52. } else {
  53. if ret.Get(0) != nil {
  54. r0 = ret.Get(0).([]state.Category)
  55. }
  56. }
  57. if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
  58. r1 = returnFunc(ctx)
  59. } else {
  60. r1 = ret.Error(1)
  61. }
  62. return r0, r1
  63. }
  64. // mockDirectoryManager_Categories_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Categories'
  65. type mockDirectoryManager_Categories_Call struct {
  66. *mock.Call
  67. }
  68. // Categories is a helper method to define mock.On call
  69. // - ctx context.Context
  70. func (_e *mockDirectoryManager_Expecter) Categories(ctx any) *mockDirectoryManager_Categories_Call {
  71. return &mockDirectoryManager_Categories_Call{Call: _e.mock.On("Categories", ctx)}
  72. }
  73. func (_c *mockDirectoryManager_Categories_Call) Run(run func(ctx context.Context)) *mockDirectoryManager_Categories_Call {
  74. _c.Call.Run(func(args mock.Arguments) {
  75. var arg0 context.Context
  76. if args[0] != nil {
  77. arg0 = args[0].(context.Context)
  78. }
  79. run(
  80. arg0,
  81. )
  82. })
  83. return _c
  84. }
  85. func (_c *mockDirectoryManager_Categories_Call) Return(categorys []state.Category, err error) *mockDirectoryManager_Categories_Call {
  86. _c.Call.Return(categorys, err)
  87. return _c
  88. }
  89. func (_c *mockDirectoryManager_Categories_Call) RunAndReturn(run func(ctx context.Context) ([]state.Category, error)) *mockDirectoryManager_Categories_Call {
  90. _c.Call.Return(run)
  91. return _c
  92. }
  93. // CreateCategory provides a mock function for the type mockDirectoryManager
  94. func (_mock *mockDirectoryManager) CreateCategory(ctx context.Context, name string) (state.Category, error) {
  95. ret := _mock.Called(ctx, name)
  96. if len(ret) == 0 {
  97. panic("no return value specified for CreateCategory")
  98. }
  99. var r0 state.Category
  100. var r1 error
  101. if returnFunc, ok := ret.Get(0).(func(context.Context, string) (state.Category, error)); ok {
  102. return returnFunc(ctx, name)
  103. }
  104. if returnFunc, ok := ret.Get(0).(func(context.Context, string) state.Category); ok {
  105. r0 = returnFunc(ctx, name)
  106. } else {
  107. r0 = ret.Get(0).(state.Category)
  108. }
  109. if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
  110. r1 = returnFunc(ctx, name)
  111. } else {
  112. r1 = ret.Error(1)
  113. }
  114. return r0, r1
  115. }
  116. // mockDirectoryManager_CreateCategory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCategory'
  117. type mockDirectoryManager_CreateCategory_Call struct {
  118. *mock.Call
  119. }
  120. // CreateCategory is a helper method to define mock.On call
  121. // - ctx context.Context
  122. // - name string
  123. func (_e *mockDirectoryManager_Expecter) CreateCategory(ctx any, name any) *mockDirectoryManager_CreateCategory_Call {
  124. return &mockDirectoryManager_CreateCategory_Call{Call: _e.mock.On("CreateCategory", ctx, name)}
  125. }
  126. func (_c *mockDirectoryManager_CreateCategory_Call) Run(run func(ctx context.Context, name string)) *mockDirectoryManager_CreateCategory_Call {
  127. _c.Call.Run(func(args mock.Arguments) {
  128. var arg0 context.Context
  129. if args[0] != nil {
  130. arg0 = args[0].(context.Context)
  131. }
  132. var arg1 string
  133. if args[1] != nil {
  134. arg1 = args[1].(string)
  135. }
  136. run(
  137. arg0,
  138. arg1,
  139. )
  140. })
  141. return _c
  142. }
  143. func (_c *mockDirectoryManager_CreateCategory_Call) Return(category state.Category, err error) *mockDirectoryManager_CreateCategory_Call {
  144. _c.Call.Return(category, err)
  145. return _c
  146. }
  147. func (_c *mockDirectoryManager_CreateCategory_Call) RunAndReturn(run func(ctx context.Context, name string) (state.Category, error)) *mockDirectoryManager_CreateCategory_Call {
  148. _c.Call.Return(run)
  149. return _c
  150. }
  151. // CreateKeyword provides a mock function for the type mockDirectoryManager
  152. func (_mock *mockDirectoryManager) CreateKeyword(ctx context.Context, name string, categoryID uint8) (state.Keyword, error) {
  153. ret := _mock.Called(ctx, name, categoryID)
  154. if len(ret) == 0 {
  155. panic("no return value specified for CreateKeyword")
  156. }
  157. var r0 state.Keyword
  158. var r1 error
  159. if returnFunc, ok := ret.Get(0).(func(context.Context, string, uint8) (state.Keyword, error)); ok {
  160. return returnFunc(ctx, name, categoryID)
  161. }
  162. if returnFunc, ok := ret.Get(0).(func(context.Context, string, uint8) state.Keyword); ok {
  163. r0 = returnFunc(ctx, name, categoryID)
  164. } else {
  165. r0 = ret.Get(0).(state.Keyword)
  166. }
  167. if returnFunc, ok := ret.Get(1).(func(context.Context, string, uint8) error); ok {
  168. r1 = returnFunc(ctx, name, categoryID)
  169. } else {
  170. r1 = ret.Error(1)
  171. }
  172. return r0, r1
  173. }
  174. // mockDirectoryManager_CreateKeyword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateKeyword'
  175. type mockDirectoryManager_CreateKeyword_Call struct {
  176. *mock.Call
  177. }
  178. // CreateKeyword is a helper method to define mock.On call
  179. // - ctx context.Context
  180. // - name string
  181. // - categoryID uint8
  182. func (_e *mockDirectoryManager_Expecter) CreateKeyword(ctx any, name any, categoryID any) *mockDirectoryManager_CreateKeyword_Call {
  183. return &mockDirectoryManager_CreateKeyword_Call{Call: _e.mock.On("CreateKeyword", ctx, name, categoryID)}
  184. }
  185. func (_c *mockDirectoryManager_CreateKeyword_Call) Run(run func(ctx context.Context, name string, categoryID uint8)) *mockDirectoryManager_CreateKeyword_Call {
  186. _c.Call.Run(func(args mock.Arguments) {
  187. var arg0 context.Context
  188. if args[0] != nil {
  189. arg0 = args[0].(context.Context)
  190. }
  191. var arg1 string
  192. if args[1] != nil {
  193. arg1 = args[1].(string)
  194. }
  195. var arg2 uint8
  196. if args[2] != nil {
  197. arg2 = args[2].(uint8)
  198. }
  199. run(
  200. arg0,
  201. arg1,
  202. arg2,
  203. )
  204. })
  205. return _c
  206. }
  207. func (_c *mockDirectoryManager_CreateKeyword_Call) Return(keyword state.Keyword, err error) *mockDirectoryManager_CreateKeyword_Call {
  208. _c.Call.Return(keyword, err)
  209. return _c
  210. }
  211. func (_c *mockDirectoryManager_CreateKeyword_Call) RunAndReturn(run func(ctx context.Context, name string, categoryID uint8) (state.Keyword, error)) *mockDirectoryManager_CreateKeyword_Call {
  212. _c.Call.Return(run)
  213. return _c
  214. }
  215. // DeleteCategory provides a mock function for the type mockDirectoryManager
  216. func (_mock *mockDirectoryManager) DeleteCategory(ctx context.Context, categoryID uint8) error {
  217. ret := _mock.Called(ctx, categoryID)
  218. if len(ret) == 0 {
  219. panic("no return value specified for DeleteCategory")
  220. }
  221. var r0 error
  222. if returnFunc, ok := ret.Get(0).(func(context.Context, uint8) error); ok {
  223. r0 = returnFunc(ctx, categoryID)
  224. } else {
  225. r0 = ret.Error(0)
  226. }
  227. return r0
  228. }
  229. // mockDirectoryManager_DeleteCategory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteCategory'
  230. type mockDirectoryManager_DeleteCategory_Call struct {
  231. *mock.Call
  232. }
  233. // DeleteCategory is a helper method to define mock.On call
  234. // - ctx context.Context
  235. // - categoryID uint8
  236. func (_e *mockDirectoryManager_Expecter) DeleteCategory(ctx any, categoryID any) *mockDirectoryManager_DeleteCategory_Call {
  237. return &mockDirectoryManager_DeleteCategory_Call{Call: _e.mock.On("DeleteCategory", ctx, categoryID)}
  238. }
  239. func (_c *mockDirectoryManager_DeleteCategory_Call) Run(run func(ctx context.Context, categoryID uint8)) *mockDirectoryManager_DeleteCategory_Call {
  240. _c.Call.Run(func(args mock.Arguments) {
  241. var arg0 context.Context
  242. if args[0] != nil {
  243. arg0 = args[0].(context.Context)
  244. }
  245. var arg1 uint8
  246. if args[1] != nil {
  247. arg1 = args[1].(uint8)
  248. }
  249. run(
  250. arg0,
  251. arg1,
  252. )
  253. })
  254. return _c
  255. }
  256. func (_c *mockDirectoryManager_DeleteCategory_Call) Return(err error) *mockDirectoryManager_DeleteCategory_Call {
  257. _c.Call.Return(err)
  258. return _c
  259. }
  260. func (_c *mockDirectoryManager_DeleteCategory_Call) RunAndReturn(run func(ctx context.Context, categoryID uint8) error) *mockDirectoryManager_DeleteCategory_Call {
  261. _c.Call.Return(run)
  262. return _c
  263. }
  264. // DeleteKeyword provides a mock function for the type mockDirectoryManager
  265. func (_mock *mockDirectoryManager) DeleteKeyword(ctx context.Context, id uint8) error {
  266. ret := _mock.Called(ctx, id)
  267. if len(ret) == 0 {
  268. panic("no return value specified for DeleteKeyword")
  269. }
  270. var r0 error
  271. if returnFunc, ok := ret.Get(0).(func(context.Context, uint8) error); ok {
  272. r0 = returnFunc(ctx, id)
  273. } else {
  274. r0 = ret.Error(0)
  275. }
  276. return r0
  277. }
  278. // mockDirectoryManager_DeleteKeyword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteKeyword'
  279. type mockDirectoryManager_DeleteKeyword_Call struct {
  280. *mock.Call
  281. }
  282. // DeleteKeyword is a helper method to define mock.On call
  283. // - ctx context.Context
  284. // - id uint8
  285. func (_e *mockDirectoryManager_Expecter) DeleteKeyword(ctx any, id any) *mockDirectoryManager_DeleteKeyword_Call {
  286. return &mockDirectoryManager_DeleteKeyword_Call{Call: _e.mock.On("DeleteKeyword", ctx, id)}
  287. }
  288. func (_c *mockDirectoryManager_DeleteKeyword_Call) Run(run func(ctx context.Context, id uint8)) *mockDirectoryManager_DeleteKeyword_Call {
  289. _c.Call.Run(func(args mock.Arguments) {
  290. var arg0 context.Context
  291. if args[0] != nil {
  292. arg0 = args[0].(context.Context)
  293. }
  294. var arg1 uint8
  295. if args[1] != nil {
  296. arg1 = args[1].(uint8)
  297. }
  298. run(
  299. arg0,
  300. arg1,
  301. )
  302. })
  303. return _c
  304. }
  305. func (_c *mockDirectoryManager_DeleteKeyword_Call) Return(err error) *mockDirectoryManager_DeleteKeyword_Call {
  306. _c.Call.Return(err)
  307. return _c
  308. }
  309. func (_c *mockDirectoryManager_DeleteKeyword_Call) RunAndReturn(run func(ctx context.Context, id uint8) error) *mockDirectoryManager_DeleteKeyword_Call {
  310. _c.Call.Return(run)
  311. return _c
  312. }
  313. // KeywordsByCategory provides a mock function for the type mockDirectoryManager
  314. func (_mock *mockDirectoryManager) KeywordsByCategory(ctx context.Context, categoryID uint8) ([]state.Keyword, error) {
  315. ret := _mock.Called(ctx, categoryID)
  316. if len(ret) == 0 {
  317. panic("no return value specified for KeywordsByCategory")
  318. }
  319. var r0 []state.Keyword
  320. var r1 error
  321. if returnFunc, ok := ret.Get(0).(func(context.Context, uint8) ([]state.Keyword, error)); ok {
  322. return returnFunc(ctx, categoryID)
  323. }
  324. if returnFunc, ok := ret.Get(0).(func(context.Context, uint8) []state.Keyword); ok {
  325. r0 = returnFunc(ctx, categoryID)
  326. } else {
  327. if ret.Get(0) != nil {
  328. r0 = ret.Get(0).([]state.Keyword)
  329. }
  330. }
  331. if returnFunc, ok := ret.Get(1).(func(context.Context, uint8) error); ok {
  332. r1 = returnFunc(ctx, categoryID)
  333. } else {
  334. r1 = ret.Error(1)
  335. }
  336. return r0, r1
  337. }
  338. // mockDirectoryManager_KeywordsByCategory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'KeywordsByCategory'
  339. type mockDirectoryManager_KeywordsByCategory_Call struct {
  340. *mock.Call
  341. }
  342. // KeywordsByCategory is a helper method to define mock.On call
  343. // - ctx context.Context
  344. // - categoryID uint8
  345. func (_e *mockDirectoryManager_Expecter) KeywordsByCategory(ctx any, categoryID any) *mockDirectoryManager_KeywordsByCategory_Call {
  346. return &mockDirectoryManager_KeywordsByCategory_Call{Call: _e.mock.On("KeywordsByCategory", ctx, categoryID)}
  347. }
  348. func (_c *mockDirectoryManager_KeywordsByCategory_Call) Run(run func(ctx context.Context, categoryID uint8)) *mockDirectoryManager_KeywordsByCategory_Call {
  349. _c.Call.Run(func(args mock.Arguments) {
  350. var arg0 context.Context
  351. if args[0] != nil {
  352. arg0 = args[0].(context.Context)
  353. }
  354. var arg1 uint8
  355. if args[1] != nil {
  356. arg1 = args[1].(uint8)
  357. }
  358. run(
  359. arg0,
  360. arg1,
  361. )
  362. })
  363. return _c
  364. }
  365. func (_c *mockDirectoryManager_KeywordsByCategory_Call) Return(keywords []state.Keyword, err error) *mockDirectoryManager_KeywordsByCategory_Call {
  366. _c.Call.Return(keywords, err)
  367. return _c
  368. }
  369. func (_c *mockDirectoryManager_KeywordsByCategory_Call) RunAndReturn(run func(ctx context.Context, categoryID uint8) ([]state.Keyword, error)) *mockDirectoryManager_KeywordsByCategory_Call {
  370. _c.Call.Return(run)
  371. return _c
  372. }