fix: move PermissionRepository mock to port/mocks (matches interface location)
PermissionRepository interface lives in application/port but .mockery.yaml had it under domain/repository, causing mockery to fail. Moved the entry to the correct package and updated test imports.
- commit
- 9dd9450664919d95248ab7441f7ed689e12d6716
- author
- brice · · 2026-03-15 18:25 UTC
- parent
- d96730e
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +310 -311
M .mockery.yaml +1 -1
| @@ -32,6 +32,7 @@ packages: | |||
| 32 | 32 | KeybindingsSaver: {} | |
| 33 | 33 | DownloadResponse: {} | |
| 34 | 34 | PermissionDialogPresenter: {} | |
| 35 | + | PermissionRepository: {} | |
| 35 | 36 | github.com/bnema/dumber/internal/domain/repository: | |
| 36 | 37 | config: | |
| 37 | 38 | dir: '{{.InterfaceDir}}/mocks' | |
| @@ -46,7 +47,6 @@ packages: | |||
| 46 | 47 | SessionStateRepository: {} | |
| 47 | 48 | TagRepository: {} | |
| 48 | 49 | ZoomRepository: {} | |
| 49 | - | PermissionRepository: {} | |
| 50 | 50 | github.com/bnema/dumber/internal/infrastructure/filtering: | |
| 51 | 51 | config: | |
| 52 | 52 | dir: '{{.InterfaceDir}}/mocks' | |
| @@ -32,6 +32,7 @@ packages: | |||||
| 32 | KeybindingsSaver: {} | 32 | KeybindingsSaver: {} | ||
| 33 | DownloadResponse: {} | 33 | DownloadResponse: {} | ||
| 34 | PermissionDialogPresenter: {} | 34 | PermissionDialogPresenter: {} | ||
| 35 | + | PermissionRepository: {} | |||
| 35 | github.com/bnema/dumber/internal/domain/repository: | 36 | github.com/bnema/dumber/internal/domain/repository: | ||
| 36 | config: | 37 | config: | ||
| 37 | dir: '{{.InterfaceDir}}/mocks' | 38 | dir: '{{.InterfaceDir}}/mocks' | ||
| @@ -46,7 +47,6 @@ packages: | |||||
| 46 | SessionStateRepository: {} | 47 | SessionStateRepository: {} | ||
| 47 | TagRepository: {} | 48 | TagRepository: {} | ||
| 48 | ZoomRepository: {} | 49 | ZoomRepository: {} | ||
| 49 | - | PermissionRepository: {} | |||
| 50 | github.com/bnema/dumber/internal/infrastructure/filtering: | 50 | github.com/bnema/dumber/internal/infrastructure/filtering: | ||
| 51 | config: | 51 | config: | ||
| 52 | dir: '{{.InterfaceDir}}/mocks' | 52 | dir: '{{.InterfaceDir}}/mocks' | ||
M internal/application/port/mocks/mocks.go +289 -0
| @@ -2225,6 +2225,295 @@ func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) RunAndReturn( | |||
| 2225 | 2225 | return _c | |
| 2226 | 2226 | } | |
| 2227 | 2227 | ||
| 2228 | + | // NewMockPermissionRepository creates a new instance of MockPermissionRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 2229 | + | // The first argument is typically a *testing.T value. | |
| 2230 | + | func NewMockPermissionRepository(t interface { | |
| 2231 | + | mock.TestingT | |
| 2232 | + | Cleanup(func()) | |
| 2233 | + | }) *MockPermissionRepository { | |
| 2234 | + | mock := &MockPermissionRepository{} | |
| 2235 | + | mock.Mock.Test(t) | |
| 2236 | + | ||
| 2237 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |
| 2238 | + | ||
| 2239 | + | return mock | |
| 2240 | + | } | |
| 2241 | + | ||
| 2242 | + | // MockPermissionRepository is an autogenerated mock type for the PermissionRepository type | |
| 2243 | + | type MockPermissionRepository struct { | |
| 2244 | + | mock.Mock | |
| 2245 | + | } | |
| 2246 | + | ||
| 2247 | + | type MockPermissionRepository_Expecter struct { | |
| 2248 | + | mock *mock.Mock | |
| 2249 | + | } | |
| 2250 | + | ||
| 2251 | + | func (_m *MockPermissionRepository) EXPECT() *MockPermissionRepository_Expecter { | |
| 2252 | + | return &MockPermissionRepository_Expecter{mock: &_m.Mock} | |
| 2253 | + | } | |
| 2254 | + | ||
| 2255 | + | // Delete provides a mock function for the type MockPermissionRepository | |
| 2256 | + | func (_mock *MockPermissionRepository) Delete(ctx context.Context, origin string, permType entity.PermissionType) error { | |
| 2257 | + | ret := _mock.Called(ctx, origin, permType) | |
| 2258 | + | ||
| 2259 | + | if len(ret) == 0 { | |
| 2260 | + | panic("no return value specified for Delete") | |
| 2261 | + | } | |
| 2262 | + | ||
| 2263 | + | var r0 error | |
| 2264 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) error); ok { | |
| 2265 | + | r0 = returnFunc(ctx, origin, permType) | |
| 2266 | + | } else { | |
| 2267 | + | r0 = ret.Error(0) | |
| 2268 | + | } | |
| 2269 | + | return r0 | |
| 2270 | + | } | |
| 2271 | + | ||
| 2272 | + | // MockPermissionRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' | |
| 2273 | + | type MockPermissionRepository_Delete_Call struct { | |
| 2274 | + | *mock.Call | |
| 2275 | + | } | |
| 2276 | + | ||
| 2277 | + | // Delete is a helper method to define mock.On call | |
| 2278 | + | // - ctx context.Context | |
| 2279 | + | // - origin string | |
| 2280 | + | // - permType entity.PermissionType | |
| 2281 | + | func (_e *MockPermissionRepository_Expecter) Delete(ctx interface{}, origin interface{}, permType interface{}) *MockPermissionRepository_Delete_Call { | |
| 2282 | + | return &MockPermissionRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, origin, permType)} | |
| 2283 | + | } | |
| 2284 | + | ||
| 2285 | + | func (_c *MockPermissionRepository_Delete_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_Delete_Call { | |
| 2286 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 2287 | + | var arg0 context.Context | |
| 2288 | + | if args[0] != nil { | |
| 2289 | + | arg0 = args[0].(context.Context) | |
| 2290 | + | } | |
| 2291 | + | var arg1 string | |
| 2292 | + | if args[1] != nil { | |
| 2293 | + | arg1 = args[1].(string) | |
| 2294 | + | } | |
| 2295 | + | var arg2 entity.PermissionType | |
| 2296 | + | if args[2] != nil { | |
| 2297 | + | arg2 = args[2].(entity.PermissionType) | |
| 2298 | + | } | |
| 2299 | + | run( | |
| 2300 | + | arg0, | |
| 2301 | + | arg1, | |
| 2302 | + | arg2, | |
| 2303 | + | ) | |
| 2304 | + | }) | |
| 2305 | + | return _c | |
| 2306 | + | } | |
| 2307 | + | ||
| 2308 | + | func (_c *MockPermissionRepository_Delete_Call) Return(err error) *MockPermissionRepository_Delete_Call { | |
| 2309 | + | _c.Call.Return(err) | |
| 2310 | + | return _c | |
| 2311 | + | } | |
| 2312 | + | ||
| 2313 | + | func (_c *MockPermissionRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) error) *MockPermissionRepository_Delete_Call { | |
| 2314 | + | _c.Call.Return(run) | |
| 2315 | + | return _c | |
| 2316 | + | } | |
| 2317 | + | ||
| 2318 | + | // Get provides a mock function for the type MockPermissionRepository | |
| 2319 | + | func (_mock *MockPermissionRepository) Get(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error) { | |
| 2320 | + | ret := _mock.Called(ctx, origin, permType) | |
| 2321 | + | ||
| 2322 | + | if len(ret) == 0 { | |
| 2323 | + | panic("no return value specified for Get") | |
| 2324 | + | } | |
| 2325 | + | ||
| 2326 | + | var r0 *entity.PermissionRecord | |
| 2327 | + | var r1 error | |
| 2328 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) (*entity.PermissionRecord, error)); ok { | |
| 2329 | + | return returnFunc(ctx, origin, permType) | |
| 2330 | + | } | |
| 2331 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) *entity.PermissionRecord); ok { | |
| 2332 | + | r0 = returnFunc(ctx, origin, permType) | |
| 2333 | + | } else { | |
| 2334 | + | if ret.Get(0) != nil { | |
| 2335 | + | r0 = ret.Get(0).(*entity.PermissionRecord) | |
| 2336 | + | } | |
| 2337 | + | } | |
| 2338 | + | if returnFunc, ok := ret.Get(1).(func(context.Context, string, entity.PermissionType) error); ok { | |
| 2339 | + | r1 = returnFunc(ctx, origin, permType) | |
| 2340 | + | } else { | |
| 2341 | + | r1 = ret.Error(1) | |
| 2342 | + | } | |
| 2343 | + | return r0, r1 | |
| 2344 | + | } | |
| 2345 | + | ||
| 2346 | + | // MockPermissionRepository_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' | |
| 2347 | + | type MockPermissionRepository_Get_Call struct { | |
| 2348 | + | *mock.Call | |
| 2349 | + | } | |
| 2350 | + | ||
| 2351 | + | // Get is a helper method to define mock.On call | |
| 2352 | + | // - ctx context.Context | |
| 2353 | + | // - origin string | |
| 2354 | + | // - permType entity.PermissionType | |
| 2355 | + | func (_e *MockPermissionRepository_Expecter) Get(ctx interface{}, origin interface{}, permType interface{}) *MockPermissionRepository_Get_Call { | |
| 2356 | + | return &MockPermissionRepository_Get_Call{Call: _e.mock.On("Get", ctx, origin, permType)} | |
| 2357 | + | } | |
| 2358 | + | ||
| 2359 | + | func (_c *MockPermissionRepository_Get_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_Get_Call { | |
| 2360 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 2361 | + | var arg0 context.Context | |
| 2362 | + | if args[0] != nil { | |
| 2363 | + | arg0 = args[0].(context.Context) | |
| 2364 | + | } | |
| 2365 | + | var arg1 string | |
| 2366 | + | if args[1] != nil { | |
| 2367 | + | arg1 = args[1].(string) | |
| 2368 | + | } | |
| 2369 | + | var arg2 entity.PermissionType | |
| 2370 | + | if args[2] != nil { | |
| 2371 | + | arg2 = args[2].(entity.PermissionType) | |
| 2372 | + | } | |
| 2373 | + | run( | |
| 2374 | + | arg0, | |
| 2375 | + | arg1, | |
| 2376 | + | arg2, | |
| 2377 | + | ) | |
| 2378 | + | }) | |
| 2379 | + | return _c | |
| 2380 | + | } | |
| 2381 | + | ||
| 2382 | + | func (_c *MockPermissionRepository_Get_Call) Return(permissionRecord *entity.PermissionRecord, err error) *MockPermissionRepository_Get_Call { | |
| 2383 | + | _c.Call.Return(permissionRecord, err) | |
| 2384 | + | return _c | |
| 2385 | + | } | |
| 2386 | + | ||
| 2387 | + | func (_c *MockPermissionRepository_Get_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error)) *MockPermissionRepository_Get_Call { | |
| 2388 | + | _c.Call.Return(run) | |
| 2389 | + | return _c | |
| 2390 | + | } | |
| 2391 | + | ||
| 2392 | + | // GetAll provides a mock function for the type MockPermissionRepository | |
| 2393 | + | func (_mock *MockPermissionRepository) GetAll(ctx context.Context, origin string) ([]*entity.PermissionRecord, error) { | |
| 2394 | + | ret := _mock.Called(ctx, origin) | |
| 2395 | + | ||
| 2396 | + | if len(ret) == 0 { | |
| 2397 | + | panic("no return value specified for GetAll") | |
| 2398 | + | } | |
| 2399 | + | ||
| 2400 | + | var r0 []*entity.PermissionRecord | |
| 2401 | + | var r1 error | |
| 2402 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]*entity.PermissionRecord, error)); ok { | |
| 2403 | + | return returnFunc(ctx, origin) | |
| 2404 | + | } | |
| 2405 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string) []*entity.PermissionRecord); ok { | |
| 2406 | + | r0 = returnFunc(ctx, origin) | |
| 2407 | + | } else { | |
| 2408 | + | if ret.Get(0) != nil { | |
| 2409 | + | r0 = ret.Get(0).([]*entity.PermissionRecord) | |
| 2410 | + | } | |
| 2411 | + | } | |
| 2412 | + | if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { | |
| 2413 | + | r1 = returnFunc(ctx, origin) | |
| 2414 | + | } else { | |
| 2415 | + | r1 = ret.Error(1) | |
| 2416 | + | } | |
| 2417 | + | return r0, r1 | |
| 2418 | + | } | |
| 2419 | + | ||
| 2420 | + | // MockPermissionRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll' | |
| 2421 | + | type MockPermissionRepository_GetAll_Call struct { | |
| 2422 | + | *mock.Call | |
| 2423 | + | } | |
| 2424 | + | ||
| 2425 | + | // GetAll is a helper method to define mock.On call | |
| 2426 | + | // - ctx context.Context | |
| 2427 | + | // - origin string | |
| 2428 | + | func (_e *MockPermissionRepository_Expecter) GetAll(ctx interface{}, origin interface{}) *MockPermissionRepository_GetAll_Call { | |
| 2429 | + | return &MockPermissionRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx, origin)} | |
| 2430 | + | } | |
| 2431 | + | ||
| 2432 | + | func (_c *MockPermissionRepository_GetAll_Call) Run(run func(ctx context.Context, origin string)) *MockPermissionRepository_GetAll_Call { | |
| 2433 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 2434 | + | var arg0 context.Context | |
| 2435 | + | if args[0] != nil { | |
| 2436 | + | arg0 = args[0].(context.Context) | |
| 2437 | + | } | |
| 2438 | + | var arg1 string | |
| 2439 | + | if args[1] != nil { | |
| 2440 | + | arg1 = args[1].(string) | |
| 2441 | + | } | |
| 2442 | + | run( | |
| 2443 | + | arg0, | |
| 2444 | + | arg1, | |
| 2445 | + | ) | |
| 2446 | + | }) | |
| 2447 | + | return _c | |
| 2448 | + | } | |
| 2449 | + | ||
| 2450 | + | func (_c *MockPermissionRepository_GetAll_Call) Return(permissionRecords []*entity.PermissionRecord, err error) *MockPermissionRepository_GetAll_Call { | |
| 2451 | + | _c.Call.Return(permissionRecords, err) | |
| 2452 | + | return _c | |
| 2453 | + | } | |
| 2454 | + | ||
| 2455 | + | func (_c *MockPermissionRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context, origin string) ([]*entity.PermissionRecord, error)) *MockPermissionRepository_GetAll_Call { | |
| 2456 | + | _c.Call.Return(run) | |
| 2457 | + | return _c | |
| 2458 | + | } | |
| 2459 | + | ||
| 2460 | + | // Set provides a mock function for the type MockPermissionRepository | |
| 2461 | + | func (_mock *MockPermissionRepository) Set(ctx context.Context, record *entity.PermissionRecord) error { | |
| 2462 | + | ret := _mock.Called(ctx, record) | |
| 2463 | + | ||
| 2464 | + | if len(ret) == 0 { | |
| 2465 | + | panic("no return value specified for Set") | |
| 2466 | + | } | |
| 2467 | + | ||
| 2468 | + | var r0 error | |
| 2469 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.PermissionRecord) error); ok { | |
| 2470 | + | r0 = returnFunc(ctx, record) | |
| 2471 | + | } else { | |
| 2472 | + | r0 = ret.Error(0) | |
| 2473 | + | } | |
| 2474 | + | return r0 | |
| 2475 | + | } | |
| 2476 | + | ||
| 2477 | + | // MockPermissionRepository_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' | |
| 2478 | + | type MockPermissionRepository_Set_Call struct { | |
| 2479 | + | *mock.Call | |
| 2480 | + | } | |
| 2481 | + | ||
| 2482 | + | // Set is a helper method to define mock.On call | |
| 2483 | + | // - ctx context.Context | |
| 2484 | + | // - record *entity.PermissionRecord | |
| 2485 | + | func (_e *MockPermissionRepository_Expecter) Set(ctx interface{}, record interface{}) *MockPermissionRepository_Set_Call { | |
| 2486 | + | return &MockPermissionRepository_Set_Call{Call: _e.mock.On("Set", ctx, record)} | |
| 2487 | + | } | |
| 2488 | + | ||
| 2489 | + | func (_c *MockPermissionRepository_Set_Call) Run(run func(ctx context.Context, record *entity.PermissionRecord)) *MockPermissionRepository_Set_Call { | |
| 2490 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 2491 | + | var arg0 context.Context | |
| 2492 | + | if args[0] != nil { | |
| 2493 | + | arg0 = args[0].(context.Context) | |
| 2494 | + | } | |
| 2495 | + | var arg1 *entity.PermissionRecord | |
| 2496 | + | if args[1] != nil { | |
| 2497 | + | arg1 = args[1].(*entity.PermissionRecord) | |
| 2498 | + | } | |
| 2499 | + | run( | |
| 2500 | + | arg0, | |
| 2501 | + | arg1, | |
| 2502 | + | ) | |
| 2503 | + | }) | |
| 2504 | + | return _c | |
| 2505 | + | } | |
| 2506 | + | ||
| 2507 | + | func (_c *MockPermissionRepository_Set_Call) Return(err error) *MockPermissionRepository_Set_Call { | |
| 2508 | + | _c.Call.Return(err) | |
| 2509 | + | return _c | |
| 2510 | + | } | |
| 2511 | + | ||
| 2512 | + | func (_c *MockPermissionRepository_Set_Call) RunAndReturn(run func(ctx context.Context, record *entity.PermissionRecord) error) *MockPermissionRepository_Set_Call { | |
| 2513 | + | _c.Call.Return(run) | |
| 2514 | + | return _c | |
| 2515 | + | } | |
| 2516 | + | ||
| 2228 | 2517 | // NewMockSessionLogger creates a new instance of MockSessionLogger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 2229 | 2518 | // The first argument is typically a *testing.T value. | |
| 2230 | 2519 | func NewMockSessionLogger(t interface { | |
| @@ -2225,6 +2225,295 @@ func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) RunAndReturn( | |||||
| 2225 | return _c | 2225 | return _c | ||
| 2226 | } | 2226 | } | ||
| 2227 | 2227 | ||||
| 2228 | + | // NewMockPermissionRepository creates a new instance of MockPermissionRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |||
| 2229 | + | // The first argument is typically a *testing.T value. | |||
| 2230 | + | func NewMockPermissionRepository(t interface { | |||
| 2231 | + | mock.TestingT | |||
| 2232 | + | Cleanup(func()) | |||
| 2233 | + | }) *MockPermissionRepository { | |||
| 2234 | + | mock := &MockPermissionRepository{} | |||
| 2235 | + | mock.Mock.Test(t) | |||
| 2236 | + | ||||
| 2237 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |||
| 2238 | + | ||||
| 2239 | + | return mock | |||
| 2240 | + | } | |||
| 2241 | + | ||||
| 2242 | + | // MockPermissionRepository is an autogenerated mock type for the PermissionRepository type | |||
| 2243 | + | type MockPermissionRepository struct { | |||
| 2244 | + | mock.Mock | |||
| 2245 | + | } | |||
| 2246 | + | ||||
| 2247 | + | type MockPermissionRepository_Expecter struct { | |||
| 2248 | + | mock *mock.Mock | |||
| 2249 | + | } | |||
| 2250 | + | ||||
| 2251 | + | func (_m *MockPermissionRepository) EXPECT() *MockPermissionRepository_Expecter { | |||
| 2252 | + | return &MockPermissionRepository_Expecter{mock: &_m.Mock} | |||
| 2253 | + | } | |||
| 2254 | + | ||||
| 2255 | + | // Delete provides a mock function for the type MockPermissionRepository | |||
| 2256 | + | func (_mock *MockPermissionRepository) Delete(ctx context.Context, origin string, permType entity.PermissionType) error { | |||
| 2257 | + | ret := _mock.Called(ctx, origin, permType) | |||
| 2258 | + | ||||
| 2259 | + | if len(ret) == 0 { | |||
| 2260 | + | panic("no return value specified for Delete") | |||
| 2261 | + | } | |||
| 2262 | + | ||||
| 2263 | + | var r0 error | |||
| 2264 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) error); ok { | |||
| 2265 | + | r0 = returnFunc(ctx, origin, permType) | |||
| 2266 | + | } else { | |||
| 2267 | + | r0 = ret.Error(0) | |||
| 2268 | + | } | |||
| 2269 | + | return r0 | |||
| 2270 | + | } | |||
| 2271 | + | ||||
| 2272 | + | // MockPermissionRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' | |||
| 2273 | + | type MockPermissionRepository_Delete_Call struct { | |||
| 2274 | + | *mock.Call | |||
| 2275 | + | } | |||
| 2276 | + | ||||
| 2277 | + | // Delete is a helper method to define mock.On call | |||
| 2278 | + | // - ctx context.Context | |||
| 2279 | + | // - origin string | |||
| 2280 | + | // - permType entity.PermissionType | |||
| 2281 | + | func (_e *MockPermissionRepository_Expecter) Delete(ctx interface{}, origin interface{}, permType interface{}) *MockPermissionRepository_Delete_Call { | |||
| 2282 | + | return &MockPermissionRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, origin, permType)} | |||
| 2283 | + | } | |||
| 2284 | + | ||||
| 2285 | + | func (_c *MockPermissionRepository_Delete_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_Delete_Call { | |||
| 2286 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 2287 | + | var arg0 context.Context | |||
| 2288 | + | if args[0] != nil { | |||
| 2289 | + | arg0 = args[0].(context.Context) | |||
| 2290 | + | } | |||
| 2291 | + | var arg1 string | |||
| 2292 | + | if args[1] != nil { | |||
| 2293 | + | arg1 = args[1].(string) | |||
| 2294 | + | } | |||
| 2295 | + | var arg2 entity.PermissionType | |||
| 2296 | + | if args[2] != nil { | |||
| 2297 | + | arg2 = args[2].(entity.PermissionType) | |||
| 2298 | + | } | |||
| 2299 | + | run( | |||
| 2300 | + | arg0, | |||
| 2301 | + | arg1, | |||
| 2302 | + | arg2, | |||
| 2303 | + | ) | |||
| 2304 | + | }) | |||
| 2305 | + | return _c | |||
| 2306 | + | } | |||
| 2307 | + | ||||
| 2308 | + | func (_c *MockPermissionRepository_Delete_Call) Return(err error) *MockPermissionRepository_Delete_Call { | |||
| 2309 | + | _c.Call.Return(err) | |||
| 2310 | + | return _c | |||
| 2311 | + | } | |||
| 2312 | + | ||||
| 2313 | + | func (_c *MockPermissionRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) error) *MockPermissionRepository_Delete_Call { | |||
| 2314 | + | _c.Call.Return(run) | |||
| 2315 | + | return _c | |||
| 2316 | + | } | |||
| 2317 | + | ||||
| 2318 | + | // Get provides a mock function for the type MockPermissionRepository | |||
| 2319 | + | func (_mock *MockPermissionRepository) Get(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error) { | |||
| 2320 | + | ret := _mock.Called(ctx, origin, permType) | |||
| 2321 | + | ||||
| 2322 | + | if len(ret) == 0 { | |||
| 2323 | + | panic("no return value specified for Get") | |||
| 2324 | + | } | |||
| 2325 | + | ||||
| 2326 | + | var r0 *entity.PermissionRecord | |||
| 2327 | + | var r1 error | |||
| 2328 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) (*entity.PermissionRecord, error)); ok { | |||
| 2329 | + | return returnFunc(ctx, origin, permType) | |||
| 2330 | + | } | |||
| 2331 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) *entity.PermissionRecord); ok { | |||
| 2332 | + | r0 = returnFunc(ctx, origin, permType) | |||
| 2333 | + | } else { | |||
| 2334 | + | if ret.Get(0) != nil { | |||
| 2335 | + | r0 = ret.Get(0).(*entity.PermissionRecord) | |||
| 2336 | + | } | |||
| 2337 | + | } | |||
| 2338 | + | if returnFunc, ok := ret.Get(1).(func(context.Context, string, entity.PermissionType) error); ok { | |||
| 2339 | + | r1 = returnFunc(ctx, origin, permType) | |||
| 2340 | + | } else { | |||
| 2341 | + | r1 = ret.Error(1) | |||
| 2342 | + | } | |||
| 2343 | + | return r0, r1 | |||
| 2344 | + | } | |||
| 2345 | + | ||||
| 2346 | + | // MockPermissionRepository_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' | |||
| 2347 | + | type MockPermissionRepository_Get_Call struct { | |||
| 2348 | + | *mock.Call | |||
| 2349 | + | } | |||
| 2350 | + | ||||
| 2351 | + | // Get is a helper method to define mock.On call | |||
| 2352 | + | // - ctx context.Context | |||
| 2353 | + | // - origin string | |||
| 2354 | + | // - permType entity.PermissionType | |||
| 2355 | + | func (_e *MockPermissionRepository_Expecter) Get(ctx interface{}, origin interface{}, permType interface{}) *MockPermissionRepository_Get_Call { | |||
| 2356 | + | return &MockPermissionRepository_Get_Call{Call: _e.mock.On("Get", ctx, origin, permType)} | |||
| 2357 | + | } | |||
| 2358 | + | ||||
| 2359 | + | func (_c *MockPermissionRepository_Get_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_Get_Call { | |||
| 2360 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 2361 | + | var arg0 context.Context | |||
| 2362 | + | if args[0] != nil { | |||
| 2363 | + | arg0 = args[0].(context.Context) | |||
| 2364 | + | } | |||
| 2365 | + | var arg1 string | |||
| 2366 | + | if args[1] != nil { | |||
| 2367 | + | arg1 = args[1].(string) | |||
| 2368 | + | } | |||
| 2369 | + | var arg2 entity.PermissionType | |||
| 2370 | + | if args[2] != nil { | |||
| 2371 | + | arg2 = args[2].(entity.PermissionType) | |||
| 2372 | + | } | |||
| 2373 | + | run( | |||
| 2374 | + | arg0, | |||
| 2375 | + | arg1, | |||
| 2376 | + | arg2, | |||
| 2377 | + | ) | |||
| 2378 | + | }) | |||
| 2379 | + | return _c | |||
| 2380 | + | } | |||
| 2381 | + | ||||
| 2382 | + | func (_c *MockPermissionRepository_Get_Call) Return(permissionRecord *entity.PermissionRecord, err error) *MockPermissionRepository_Get_Call { | |||
| 2383 | + | _c.Call.Return(permissionRecord, err) | |||
| 2384 | + | return _c | |||
| 2385 | + | } | |||
| 2386 | + | ||||
| 2387 | + | func (_c *MockPermissionRepository_Get_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error)) *MockPermissionRepository_Get_Call { | |||
| 2388 | + | _c.Call.Return(run) | |||
| 2389 | + | return _c | |||
| 2390 | + | } | |||
| 2391 | + | ||||
| 2392 | + | // GetAll provides a mock function for the type MockPermissionRepository | |||
| 2393 | + | func (_mock *MockPermissionRepository) GetAll(ctx context.Context, origin string) ([]*entity.PermissionRecord, error) { | |||
| 2394 | + | ret := _mock.Called(ctx, origin) | |||
| 2395 | + | ||||
| 2396 | + | if len(ret) == 0 { | |||
| 2397 | + | panic("no return value specified for GetAll") | |||
| 2398 | + | } | |||
| 2399 | + | ||||
| 2400 | + | var r0 []*entity.PermissionRecord | |||
| 2401 | + | var r1 error | |||
| 2402 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]*entity.PermissionRecord, error)); ok { | |||
| 2403 | + | return returnFunc(ctx, origin) | |||
| 2404 | + | } | |||
| 2405 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, string) []*entity.PermissionRecord); ok { | |||
| 2406 | + | r0 = returnFunc(ctx, origin) | |||
| 2407 | + | } else { | |||
| 2408 | + | if ret.Get(0) != nil { | |||
| 2409 | + | r0 = ret.Get(0).([]*entity.PermissionRecord) | |||
| 2410 | + | } | |||
| 2411 | + | } | |||
| 2412 | + | if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { | |||
| 2413 | + | r1 = returnFunc(ctx, origin) | |||
| 2414 | + | } else { | |||
| 2415 | + | r1 = ret.Error(1) | |||
| 2416 | + | } | |||
| 2417 | + | return r0, r1 | |||
| 2418 | + | } | |||
| 2419 | + | ||||
| 2420 | + | // MockPermissionRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll' | |||
| 2421 | + | type MockPermissionRepository_GetAll_Call struct { | |||
| 2422 | + | *mock.Call | |||
| 2423 | + | } | |||
| 2424 | + | ||||
| 2425 | + | // GetAll is a helper method to define mock.On call | |||
| 2426 | + | // - ctx context.Context | |||
| 2427 | + | // - origin string | |||
| 2428 | + | func (_e *MockPermissionRepository_Expecter) GetAll(ctx interface{}, origin interface{}) *MockPermissionRepository_GetAll_Call { | |||
| 2429 | + | return &MockPermissionRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx, origin)} | |||
| 2430 | + | } | |||
| 2431 | + | ||||
| 2432 | + | func (_c *MockPermissionRepository_GetAll_Call) Run(run func(ctx context.Context, origin string)) *MockPermissionRepository_GetAll_Call { | |||
| 2433 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 2434 | + | var arg0 context.Context | |||
| 2435 | + | if args[0] != nil { | |||
| 2436 | + | arg0 = args[0].(context.Context) | |||
| 2437 | + | } | |||
| 2438 | + | var arg1 string | |||
| 2439 | + | if args[1] != nil { | |||
| 2440 | + | arg1 = args[1].(string) | |||
| 2441 | + | } | |||
| 2442 | + | run( | |||
| 2443 | + | arg0, | |||
| 2444 | + | arg1, | |||
| 2445 | + | ) | |||
| 2446 | + | }) | |||
| 2447 | + | return _c | |||
| 2448 | + | } | |||
| 2449 | + | ||||
| 2450 | + | func (_c *MockPermissionRepository_GetAll_Call) Return(permissionRecords []*entity.PermissionRecord, err error) *MockPermissionRepository_GetAll_Call { | |||
| 2451 | + | _c.Call.Return(permissionRecords, err) | |||
| 2452 | + | return _c | |||
| 2453 | + | } | |||
| 2454 | + | ||||
| 2455 | + | func (_c *MockPermissionRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context, origin string) ([]*entity.PermissionRecord, error)) *MockPermissionRepository_GetAll_Call { | |||
| 2456 | + | _c.Call.Return(run) | |||
| 2457 | + | return _c | |||
| 2458 | + | } | |||
| 2459 | + | ||||
| 2460 | + | // Set provides a mock function for the type MockPermissionRepository | |||
| 2461 | + | func (_mock *MockPermissionRepository) Set(ctx context.Context, record *entity.PermissionRecord) error { | |||
| 2462 | + | ret := _mock.Called(ctx, record) | |||
| 2463 | + | ||||
| 2464 | + | if len(ret) == 0 { | |||
| 2465 | + | panic("no return value specified for Set") | |||
| 2466 | + | } | |||
| 2467 | + | ||||
| 2468 | + | var r0 error | |||
| 2469 | + | if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.PermissionRecord) error); ok { | |||
| 2470 | + | r0 = returnFunc(ctx, record) | |||
| 2471 | + | } else { | |||
| 2472 | + | r0 = ret.Error(0) | |||
| 2473 | + | } | |||
| 2474 | + | return r0 | |||
| 2475 | + | } | |||
| 2476 | + | ||||
| 2477 | + | // MockPermissionRepository_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' | |||
| 2478 | + | type MockPermissionRepository_Set_Call struct { | |||
| 2479 | + | *mock.Call | |||
| 2480 | + | } | |||
| 2481 | + | ||||
| 2482 | + | // Set is a helper method to define mock.On call | |||
| 2483 | + | // - ctx context.Context | |||
| 2484 | + | // - record *entity.PermissionRecord | |||
| 2485 | + | func (_e *MockPermissionRepository_Expecter) Set(ctx interface{}, record interface{}) *MockPermissionRepository_Set_Call { | |||
| 2486 | + | return &MockPermissionRepository_Set_Call{Call: _e.mock.On("Set", ctx, record)} | |||
| 2487 | + | } | |||
| 2488 | + | ||||
| 2489 | + | func (_c *MockPermissionRepository_Set_Call) Run(run func(ctx context.Context, record *entity.PermissionRecord)) *MockPermissionRepository_Set_Call { | |||
| 2490 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 2491 | + | var arg0 context.Context | |||
| 2492 | + | if args[0] != nil { | |||
| 2493 | + | arg0 = args[0].(context.Context) | |||
| 2494 | + | } | |||
| 2495 | + | var arg1 *entity.PermissionRecord | |||
| 2496 | + | if args[1] != nil { | |||
| 2497 | + | arg1 = args[1].(*entity.PermissionRecord) | |||
| 2498 | + | } | |||
| 2499 | + | run( | |||
| 2500 | + | arg0, | |||
| 2501 | + | arg1, | |||
| 2502 | + | ) | |||
| 2503 | + | }) | |||
| 2504 | + | return _c | |||
| 2505 | + | } | |||
| 2506 | + | ||||
| 2507 | + | func (_c *MockPermissionRepository_Set_Call) Return(err error) *MockPermissionRepository_Set_Call { | |||
| 2508 | + | _c.Call.Return(err) | |||
| 2509 | + | return _c | |||
| 2510 | + | } | |||
| 2511 | + | ||||
| 2512 | + | func (_c *MockPermissionRepository_Set_Call) RunAndReturn(run func(ctx context.Context, record *entity.PermissionRecord) error) *MockPermissionRepository_Set_Call { | |||
| 2513 | + | _c.Call.Return(run) | |||
| 2514 | + | return _c | |||
| 2515 | + | } | |||
| 2516 | + | ||||
| 2228 | // NewMockSessionLogger creates a new instance of MockSessionLogger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | 2517 | // NewMockSessionLogger creates a new instance of MockSessionLogger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | ||
| 2229 | // The first argument is typically a *testing.T value. | 2518 | // The first argument is typically a *testing.T value. | ||
| 2230 | func NewMockSessionLogger(t interface { | 2519 | func NewMockSessionLogger(t interface { | ||
M internal/application/usecase/handle_permission_test.go +20 -21
| @@ -9,7 +9,6 @@ import ( | |||
| 9 | 9 | portmocks "github.com/bnema/dumber/internal/application/port/mocks" | |
| 10 | 10 | "github.com/bnema/dumber/internal/application/usecase" | |
| 11 | 11 | "github.com/bnema/dumber/internal/domain/entity" | |
| 12 | - | repomocks "github.com/bnema/dumber/internal/domain/repository/mocks" | |
| 13 | 12 | "github.com/rs/zerolog" | |
| 14 | 13 | "github.com/stretchr/testify/assert" | |
| 15 | 14 | "github.com/stretchr/testify/mock" | |
| @@ -22,7 +21,7 @@ func permissionLoggerFromContext(ctx context.Context) *zerolog.Logger { | |||
| 22 | 21 | ||
| 23 | 22 | func TestHandlePermissionUseCase_AutoAllowDisplayCapture(t *testing.T) { | |
| 24 | 23 | ctx := testContext() | |
| 25 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 24 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 26 | 25 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 27 | 26 | ||
| 28 | 27 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -49,7 +48,7 @@ func TestHandlePermissionUseCase_AutoAllowDisplayCapture(t *testing.T) { | |||
| 49 | 48 | ||
| 50 | 49 | func TestHandlePermissionUseCase_AutoAllowDeviceInfo(t *testing.T) { | |
| 51 | 50 | ctx := testContext() | |
| 52 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 51 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 53 | 52 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 54 | 53 | ||
| 55 | 54 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -73,7 +72,7 @@ func TestHandlePermissionUseCase_AutoAllowDeviceInfo(t *testing.T) { | |||
| 73 | 72 | ||
| 74 | 73 | func TestHandlePermissionUseCase_StoredPermissionGranted(t *testing.T) { | |
| 75 | 74 | ctx := testContext() | |
| 76 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 75 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 77 | 76 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 78 | 77 | ||
| 79 | 78 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -103,7 +102,7 @@ func TestHandlePermissionUseCase_StoredPermissionGranted(t *testing.T) { | |||
| 103 | 102 | ||
| 104 | 103 | func TestHandlePermissionUseCase_StoredPermissionDenied(t *testing.T) { | |
| 105 | 104 | ctx := testContext() | |
| 106 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 105 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 107 | 106 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 108 | 107 | ||
| 109 | 108 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -133,7 +132,7 @@ func TestHandlePermissionUseCase_StoredPermissionDenied(t *testing.T) { | |||
| 133 | 132 | ||
| 134 | 133 | func TestHandlePermissionUseCase_ShowDialogForPrompt(t *testing.T) { | |
| 135 | 134 | ctx := testContext() | |
| 136 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 135 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 137 | 136 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 138 | 137 | ||
| 139 | 138 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -166,7 +165,7 @@ func TestHandlePermissionUseCase_ShowDialogForPrompt(t *testing.T) { | |||
| 166 | 165 | ||
| 167 | 166 | func TestHandlePermissionUseCase_PersistAllowed(t *testing.T) { | |
| 168 | 167 | ctx := testContext() | |
| 169 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 168 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 170 | 169 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 171 | 170 | ||
| 172 | 171 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -205,7 +204,7 @@ func TestHandlePermissionUseCase_PersistAllowed(t *testing.T) { | |||
| 205 | 204 | ||
| 206 | 205 | func TestHandlePermissionUseCase_PersistDenied(t *testing.T) { | |
| 207 | 206 | ctx := testContext() | |
| 208 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 207 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 209 | 208 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 210 | 209 | ||
| 211 | 210 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -243,7 +242,7 @@ func TestHandlePermissionUseCase_PersistDenied(t *testing.T) { | |||
| 243 | 242 | ||
| 244 | 243 | func TestHandlePermissionUseCase_EmptyOrigin(t *testing.T) { | |
| 245 | 244 | ctx := testContext() | |
| 246 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 245 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 247 | 246 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 248 | 247 | ||
| 249 | 248 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -264,7 +263,7 @@ func TestHandlePermissionUseCase_EmptyOrigin(t *testing.T) { | |||
| 264 | 263 | ||
| 265 | 264 | func TestHandlePermissionUseCase_CombinedPermissions(t *testing.T) { | |
| 266 | 265 | ctx := testContext() | |
| 267 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 266 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 268 | 267 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 269 | 268 | ||
| 270 | 269 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -300,7 +299,7 @@ func TestHandlePermissionUseCase_CombinedPermissions(t *testing.T) { | |||
| 300 | 299 | ||
| 301 | 300 | func TestHandlePermissionUseCase_QueryPermissionState_AutoAllow(t *testing.T) { | |
| 302 | 301 | ctx := testContext() | |
| 303 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 302 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 304 | 303 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 305 | 304 | ||
| 306 | 305 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -314,7 +313,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_AutoAllow(t *testing.T) { | |||
| 314 | 313 | ||
| 315 | 314 | func TestHandlePermissionUseCase_QueryPermissionState_AutoAllowManualOverride(t *testing.T) { | |
| 316 | 315 | ctx := testContext() | |
| 317 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 316 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 318 | 317 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 319 | 318 | ||
| 320 | 319 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -333,7 +332,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_AutoAllowManualOverride(t | |||
| 333 | 332 | ||
| 334 | 333 | func TestHandlePermissionUseCase_QueryPermissionState_Stored(t *testing.T) { | |
| 335 | 334 | ctx := testContext() | |
| 336 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 335 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 337 | 336 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 338 | 337 | ||
| 339 | 338 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -352,7 +351,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_Stored(t *testing.T) { | |||
| 352 | 351 | ||
| 353 | 352 | func TestHandlePermissionUseCase_QueryPermissionState_NoRecord(t *testing.T) { | |
| 354 | 353 | ctx := testContext() | |
| 355 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 354 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 356 | 355 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 357 | 356 | ||
| 358 | 357 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -367,7 +366,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_NoRecord(t *testing.T) { | |||
| 367 | 366 | ||
| 368 | 367 | func TestHandlePermissionUseCase_QueryPermissionState_EmptyOriginReturnsPrompt(t *testing.T) { | |
| 369 | 368 | ctx := testContext() | |
| 370 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 369 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 371 | 370 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 372 | 371 | ||
| 373 | 372 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -380,7 +379,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_EmptyOriginReturnsPrompt(t | |||
| 380 | 379 | ||
| 381 | 380 | func TestHandlePermissionUseCase_NonPersistableNotSaved(t *testing.T) { | |
| 382 | 381 | ctx := testContext() | |
| 383 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 382 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 384 | 383 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 385 | 384 | ||
| 386 | 385 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -407,7 +406,7 @@ func TestHandlePermissionUseCase_NonPersistableNotSaved(t *testing.T) { | |||
| 407 | 406 | ||
| 408 | 407 | func TestHandlePermissionUseCase_NoDialogPresenter(t *testing.T) { | |
| 409 | 408 | ctx := testContext() | |
| 410 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 409 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 411 | 410 | ||
| 412 | 411 | // Create use case with nil dialog presenter | |
| 413 | 412 | uc := usecase.NewHandlePermissionUseCase(permRepo, nil, permissionLoggerFromContext) | |
| @@ -431,7 +430,7 @@ func TestHandlePermissionUseCase_NoDialogPresenter(t *testing.T) { | |||
| 431 | 430 | ||
| 432 | 431 | func TestHandlePermissionUseCase_DisplayOverrideDenied(t *testing.T) { | |
| 433 | 432 | ctx := testContext() | |
| 434 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 433 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 435 | 434 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 436 | 435 | ||
| 437 | 436 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | |
| @@ -459,7 +458,7 @@ func TestHandlePermissionUseCase_DisplayOverrideDenied(t *testing.T) { | |||
| 459 | 458 | ||
| 460 | 459 | func TestHandlePermissionUseCase_GetSetResetManualDecision(t *testing.T) { | |
| 461 | 460 | ctx := testContext() | |
| 462 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 461 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 463 | 462 | uc := usecase.NewHandlePermissionUseCase(permRepo, nil, permissionLoggerFromContext) | |
| 464 | 463 | ||
| 465 | 464 | permRepo.EXPECT().Set(mock.Anything, mock.AnythingOfType("*entity.PermissionRecord")). | |
| @@ -499,7 +498,7 @@ func TestHandlePermissionUseCase_GetSetResetManualDecision(t *testing.T) { | |||
| 499 | 498 | ||
| 500 | 499 | func TestHandlePermissionUseCase_SetManualPermissionDecision_NonPersistable(t *testing.T) { | |
| 501 | 500 | ctx := testContext() | |
| 502 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 501 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 503 | 502 | uc := usecase.NewHandlePermissionUseCase(permRepo, nil, permissionLoggerFromContext) | |
| 504 | 503 | ||
| 505 | 504 | err := uc.SetManualPermissionDecision( | |
| @@ -517,7 +516,7 @@ func TestHandlePermissionUseCase_SetManualPermissionDecision_NonPersistable(t *t | |||
| 517 | 516 | ||
| 518 | 517 | func TestHandlePermissionUseCase_UsesInjectedLoggerFactory(t *testing.T) { | |
| 519 | 518 | ctx := testContext() | |
| 520 | - | permRepo := repomocks.NewMockPermissionRepository(t) | |
| 519 | + | permRepo := portmocks.NewMockPermissionRepository(t) | |
| 521 | 520 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | |
| 522 | 521 | ||
| 523 | 522 | called := false | |
| @@ -9,7 +9,6 @@ import ( | |||||
| 9 | portmocks "github.com/bnema/dumber/internal/application/port/mocks" | 9 | portmocks "github.com/bnema/dumber/internal/application/port/mocks" | ||
| 10 | "github.com/bnema/dumber/internal/application/usecase" | 10 | "github.com/bnema/dumber/internal/application/usecase" | ||
| 11 | "github.com/bnema/dumber/internal/domain/entity" | 11 | "github.com/bnema/dumber/internal/domain/entity" | ||
| 12 | - | repomocks "github.com/bnema/dumber/internal/domain/repository/mocks" | |||
| 13 | "github.com/rs/zerolog" | 12 | "github.com/rs/zerolog" | ||
| 14 | "github.com/stretchr/testify/assert" | 13 | "github.com/stretchr/testify/assert" | ||
| 15 | "github.com/stretchr/testify/mock" | 14 | "github.com/stretchr/testify/mock" | ||
| @@ -22,7 +21,7 @@ func permissionLoggerFromContext(ctx context.Context) *zerolog.Logger { | |||||
| 22 | 21 | ||||
| 23 | func TestHandlePermissionUseCase_AutoAllowDisplayCapture(t *testing.T) { | 22 | func TestHandlePermissionUseCase_AutoAllowDisplayCapture(t *testing.T) { | ||
| 24 | ctx := testContext() | 23 | ctx := testContext() | ||
| 25 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 24 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 26 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 25 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 27 | 26 | ||||
| 28 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 27 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -49,7 +48,7 @@ func TestHandlePermissionUseCase_AutoAllowDisplayCapture(t *testing.T) { | |||||
| 49 | 48 | ||||
| 50 | func TestHandlePermissionUseCase_AutoAllowDeviceInfo(t *testing.T) { | 49 | func TestHandlePermissionUseCase_AutoAllowDeviceInfo(t *testing.T) { | ||
| 51 | ctx := testContext() | 50 | ctx := testContext() | ||
| 52 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 51 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 53 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 52 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 54 | 53 | ||||
| 55 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 54 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -73,7 +72,7 @@ func TestHandlePermissionUseCase_AutoAllowDeviceInfo(t *testing.T) { | |||||
| 73 | 72 | ||||
| 74 | func TestHandlePermissionUseCase_StoredPermissionGranted(t *testing.T) { | 73 | func TestHandlePermissionUseCase_StoredPermissionGranted(t *testing.T) { | ||
| 75 | ctx := testContext() | 74 | ctx := testContext() | ||
| 76 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 75 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 77 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 76 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 78 | 77 | ||||
| 79 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 78 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -103,7 +102,7 @@ func TestHandlePermissionUseCase_StoredPermissionGranted(t *testing.T) { | |||||
| 103 | 102 | ||||
| 104 | func TestHandlePermissionUseCase_StoredPermissionDenied(t *testing.T) { | 103 | func TestHandlePermissionUseCase_StoredPermissionDenied(t *testing.T) { | ||
| 105 | ctx := testContext() | 104 | ctx := testContext() | ||
| 106 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 105 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 107 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 106 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 108 | 107 | ||||
| 109 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 108 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -133,7 +132,7 @@ func TestHandlePermissionUseCase_StoredPermissionDenied(t *testing.T) { | |||||
| 133 | 132 | ||||
| 134 | func TestHandlePermissionUseCase_ShowDialogForPrompt(t *testing.T) { | 133 | func TestHandlePermissionUseCase_ShowDialogForPrompt(t *testing.T) { | ||
| 135 | ctx := testContext() | 134 | ctx := testContext() | ||
| 136 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 135 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 137 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 136 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 138 | 137 | ||||
| 139 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 138 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -166,7 +165,7 @@ func TestHandlePermissionUseCase_ShowDialogForPrompt(t *testing.T) { | |||||
| 166 | 165 | ||||
| 167 | func TestHandlePermissionUseCase_PersistAllowed(t *testing.T) { | 166 | func TestHandlePermissionUseCase_PersistAllowed(t *testing.T) { | ||
| 168 | ctx := testContext() | 167 | ctx := testContext() | ||
| 169 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 168 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 170 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 169 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 171 | 170 | ||||
| 172 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 171 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -205,7 +204,7 @@ func TestHandlePermissionUseCase_PersistAllowed(t *testing.T) { | |||||
| 205 | 204 | ||||
| 206 | func TestHandlePermissionUseCase_PersistDenied(t *testing.T) { | 205 | func TestHandlePermissionUseCase_PersistDenied(t *testing.T) { | ||
| 207 | ctx := testContext() | 206 | ctx := testContext() | ||
| 208 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 207 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 209 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 208 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 210 | 209 | ||||
| 211 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 210 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -243,7 +242,7 @@ func TestHandlePermissionUseCase_PersistDenied(t *testing.T) { | |||||
| 243 | 242 | ||||
| 244 | func TestHandlePermissionUseCase_EmptyOrigin(t *testing.T) { | 243 | func TestHandlePermissionUseCase_EmptyOrigin(t *testing.T) { | ||
| 245 | ctx := testContext() | 244 | ctx := testContext() | ||
| 246 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 245 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 247 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 246 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 248 | 247 | ||||
| 249 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 248 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -264,7 +263,7 @@ func TestHandlePermissionUseCase_EmptyOrigin(t *testing.T) { | |||||
| 264 | 263 | ||||
| 265 | func TestHandlePermissionUseCase_CombinedPermissions(t *testing.T) { | 264 | func TestHandlePermissionUseCase_CombinedPermissions(t *testing.T) { | ||
| 266 | ctx := testContext() | 265 | ctx := testContext() | ||
| 267 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 266 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 268 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 267 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 269 | 268 | ||||
| 270 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 269 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -300,7 +299,7 @@ func TestHandlePermissionUseCase_CombinedPermissions(t *testing.T) { | |||||
| 300 | 299 | ||||
| 301 | func TestHandlePermissionUseCase_QueryPermissionState_AutoAllow(t *testing.T) { | 300 | func TestHandlePermissionUseCase_QueryPermissionState_AutoAllow(t *testing.T) { | ||
| 302 | ctx := testContext() | 301 | ctx := testContext() | ||
| 303 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 302 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 304 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 303 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 305 | 304 | ||||
| 306 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 305 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -314,7 +313,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_AutoAllow(t *testing.T) { | |||||
| 314 | 313 | ||||
| 315 | func TestHandlePermissionUseCase_QueryPermissionState_AutoAllowManualOverride(t *testing.T) { | 314 | func TestHandlePermissionUseCase_QueryPermissionState_AutoAllowManualOverride(t *testing.T) { | ||
| 316 | ctx := testContext() | 315 | ctx := testContext() | ||
| 317 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 316 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 318 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 317 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 319 | 318 | ||||
| 320 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 319 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -333,7 +332,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_AutoAllowManualOverride(t | |||||
| 333 | 332 | ||||
| 334 | func TestHandlePermissionUseCase_QueryPermissionState_Stored(t *testing.T) { | 333 | func TestHandlePermissionUseCase_QueryPermissionState_Stored(t *testing.T) { | ||
| 335 | ctx := testContext() | 334 | ctx := testContext() | ||
| 336 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 335 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 337 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 336 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 338 | 337 | ||||
| 339 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 338 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -352,7 +351,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_Stored(t *testing.T) { | |||||
| 352 | 351 | ||||
| 353 | func TestHandlePermissionUseCase_QueryPermissionState_NoRecord(t *testing.T) { | 352 | func TestHandlePermissionUseCase_QueryPermissionState_NoRecord(t *testing.T) { | ||
| 354 | ctx := testContext() | 353 | ctx := testContext() | ||
| 355 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 354 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 356 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 355 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 357 | 356 | ||||
| 358 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 357 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -367,7 +366,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_NoRecord(t *testing.T) { | |||||
| 367 | 366 | ||||
| 368 | func TestHandlePermissionUseCase_QueryPermissionState_EmptyOriginReturnsPrompt(t *testing.T) { | 367 | func TestHandlePermissionUseCase_QueryPermissionState_EmptyOriginReturnsPrompt(t *testing.T) { | ||
| 369 | ctx := testContext() | 368 | ctx := testContext() | ||
| 370 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 369 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 371 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 370 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 372 | 371 | ||||
| 373 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 372 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -380,7 +379,7 @@ func TestHandlePermissionUseCase_QueryPermissionState_EmptyOriginReturnsPrompt(t | |||||
| 380 | 379 | ||||
| 381 | func TestHandlePermissionUseCase_NonPersistableNotSaved(t *testing.T) { | 380 | func TestHandlePermissionUseCase_NonPersistableNotSaved(t *testing.T) { | ||
| 382 | ctx := testContext() | 381 | ctx := testContext() | ||
| 383 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 382 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 384 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 383 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 385 | 384 | ||||
| 386 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 385 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -407,7 +406,7 @@ func TestHandlePermissionUseCase_NonPersistableNotSaved(t *testing.T) { | |||||
| 407 | 406 | ||||
| 408 | func TestHandlePermissionUseCase_NoDialogPresenter(t *testing.T) { | 407 | func TestHandlePermissionUseCase_NoDialogPresenter(t *testing.T) { | ||
| 409 | ctx := testContext() | 408 | ctx := testContext() | ||
| 410 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 409 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 411 | 410 | ||||
| 412 | // Create use case with nil dialog presenter | 411 | // Create use case with nil dialog presenter | ||
| 413 | uc := usecase.NewHandlePermissionUseCase(permRepo, nil, permissionLoggerFromContext) | 412 | uc := usecase.NewHandlePermissionUseCase(permRepo, nil, permissionLoggerFromContext) | ||
| @@ -431,7 +430,7 @@ func TestHandlePermissionUseCase_NoDialogPresenter(t *testing.T) { | |||||
| 431 | 430 | ||||
| 432 | func TestHandlePermissionUseCase_DisplayOverrideDenied(t *testing.T) { | 431 | func TestHandlePermissionUseCase_DisplayOverrideDenied(t *testing.T) { | ||
| 433 | ctx := testContext() | 432 | ctx := testContext() | ||
| 434 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 433 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 435 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 434 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 436 | 435 | ||||
| 437 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | 436 | uc := usecase.NewHandlePermissionUseCase(permRepo, dialog, permissionLoggerFromContext) | ||
| @@ -459,7 +458,7 @@ func TestHandlePermissionUseCase_DisplayOverrideDenied(t *testing.T) { | |||||
| 459 | 458 | ||||
| 460 | func TestHandlePermissionUseCase_GetSetResetManualDecision(t *testing.T) { | 459 | func TestHandlePermissionUseCase_GetSetResetManualDecision(t *testing.T) { | ||
| 461 | ctx := testContext() | 460 | ctx := testContext() | ||
| 462 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 461 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 463 | uc := usecase.NewHandlePermissionUseCase(permRepo, nil, permissionLoggerFromContext) | 462 | uc := usecase.NewHandlePermissionUseCase(permRepo, nil, permissionLoggerFromContext) | ||
| 464 | 463 | ||||
| 465 | permRepo.EXPECT().Set(mock.Anything, mock.AnythingOfType("*entity.PermissionRecord")). | 464 | permRepo.EXPECT().Set(mock.Anything, mock.AnythingOfType("*entity.PermissionRecord")). | ||
| @@ -499,7 +498,7 @@ func TestHandlePermissionUseCase_GetSetResetManualDecision(t *testing.T) { | |||||
| 499 | 498 | ||||
| 500 | func TestHandlePermissionUseCase_SetManualPermissionDecision_NonPersistable(t *testing.T) { | 499 | func TestHandlePermissionUseCase_SetManualPermissionDecision_NonPersistable(t *testing.T) { | ||
| 501 | ctx := testContext() | 500 | ctx := testContext() | ||
| 502 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 501 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 503 | uc := usecase.NewHandlePermissionUseCase(permRepo, nil, permissionLoggerFromContext) | 502 | uc := usecase.NewHandlePermissionUseCase(permRepo, nil, permissionLoggerFromContext) | ||
| 504 | 503 | ||||
| 505 | err := uc.SetManualPermissionDecision( | 504 | err := uc.SetManualPermissionDecision( | ||
| @@ -517,7 +516,7 @@ func TestHandlePermissionUseCase_SetManualPermissionDecision_NonPersistable(t *t | |||||
| 517 | 516 | ||||
| 518 | func TestHandlePermissionUseCase_UsesInjectedLoggerFactory(t *testing.T) { | 517 | func TestHandlePermissionUseCase_UsesInjectedLoggerFactory(t *testing.T) { | ||
| 519 | ctx := testContext() | 518 | ctx := testContext() | ||
| 520 | - | permRepo := repomocks.NewMockPermissionRepository(t) | 519 | + | permRepo := portmocks.NewMockPermissionRepository(t) |
| 521 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | 520 | dialog := portmocks.NewMockPermissionDialogPresenter(t) | ||
| 522 | 521 | ||||
| 523 | called := false | 522 | called := false | ||
M internal/domain/repository/mocks/mocks.go +0 -289
| @@ -2979,295 +2979,6 @@ func (_c *MockHistoryRepository_Search_Call) RunAndReturn(run func(ctx context.C | |||
| 2979 | 2979 | return _c | |
| 2980 | 2980 | } | |
| 2981 | 2981 | ||
| 2982 | - | // NewMockPermissionRepository creates a new instance of MockPermissionRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 2983 | - | // The first argument is typically a *testing.T value. | |
| 2984 | - | func NewMockPermissionRepository(t interface { | |
| 2985 | - | mock.TestingT | |
| 2986 | - | Cleanup(func()) | |
| 2987 | - | }) *MockPermissionRepository { | |
| 2988 | - | mock := &MockPermissionRepository{} | |
| 2989 | - | mock.Mock.Test(t) | |
| 2990 | - | ||
| 2991 | - | t.Cleanup(func() { mock.AssertExpectations(t) }) | |
| 2992 | - | ||
| 2993 | - | return mock | |
| 2994 | - | } | |
| 2995 | - | ||
| 2996 | - | // MockPermissionRepository is an autogenerated mock type for the PermissionRepository type | |
| 2997 | - | type MockPermissionRepository struct { | |
| 2998 | - | mock.Mock | |
| 2999 | - | } | |
| 3000 | - | ||
| 3001 | - | type MockPermissionRepository_Expecter struct { | |
| 3002 | - | mock *mock.Mock | |
| 3003 | - | } | |
| 3004 | - | ||
| 3005 | - | func (_m *MockPermissionRepository) EXPECT() *MockPermissionRepository_Expecter { | |
| 3006 | - | return &MockPermissionRepository_Expecter{mock: &_m.Mock} | |
| 3007 | - | } | |
| 3008 | - | ||
| 3009 | - | // Delete provides a mock function for the type MockPermissionRepository | |
| 3010 | - | func (_mock *MockPermissionRepository) Delete(ctx context.Context, origin string, permType entity.PermissionType) error { | |
| 3011 | - | ret := _mock.Called(ctx, origin, permType) | |
| 3012 | - | ||
| 3013 | - | if len(ret) == 0 { | |
| 3014 | - | panic("no return value specified for Delete") | |
| 3015 | - | } | |
| 3016 | - | ||
| 3017 | - | var r0 error | |
| 3018 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) error); ok { | |
| 3019 | - | r0 = returnFunc(ctx, origin, permType) | |
| 3020 | - | } else { | |
| 3021 | - | r0 = ret.Error(0) | |
| 3022 | - | } | |
| 3023 | - | return r0 | |
| 3024 | - | } | |
| 3025 | - | ||
| 3026 | - | // MockPermissionRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' | |
| 3027 | - | type MockPermissionRepository_Delete_Call struct { | |
| 3028 | - | *mock.Call | |
| 3029 | - | } | |
| 3030 | - | ||
| 3031 | - | // Delete is a helper method to define mock.On call | |
| 3032 | - | // - ctx context.Context | |
| 3033 | - | // - origin string | |
| 3034 | - | // - permType entity.PermissionType | |
| 3035 | - | func (_e *MockPermissionRepository_Expecter) Delete(ctx interface{}, origin interface{}, permType interface{}) *MockPermissionRepository_Delete_Call { | |
| 3036 | - | return &MockPermissionRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, origin, permType)} | |
| 3037 | - | } | |
| 3038 | - | ||
| 3039 | - | func (_c *MockPermissionRepository_Delete_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_Delete_Call { | |
| 3040 | - | _c.Call.Run(func(args mock.Arguments) { | |
| 3041 | - | var arg0 context.Context | |
| 3042 | - | if args[0] != nil { | |
| 3043 | - | arg0 = args[0].(context.Context) | |
| 3044 | - | } | |
| 3045 | - | var arg1 string | |
| 3046 | - | if args[1] != nil { | |
| 3047 | - | arg1 = args[1].(string) | |
| 3048 | - | } | |
| 3049 | - | var arg2 entity.PermissionType | |
| 3050 | - | if args[2] != nil { | |
| 3051 | - | arg2 = args[2].(entity.PermissionType) | |
| 3052 | - | } | |
| 3053 | - | run( | |
| 3054 | - | arg0, | |
| 3055 | - | arg1, | |
| 3056 | - | arg2, | |
| 3057 | - | ) | |
| 3058 | - | }) | |
| 3059 | - | return _c | |
| 3060 | - | } | |
| 3061 | - | ||
| 3062 | - | func (_c *MockPermissionRepository_Delete_Call) Return(err error) *MockPermissionRepository_Delete_Call { | |
| 3063 | - | _c.Call.Return(err) | |
| 3064 | - | return _c | |
| 3065 | - | } | |
| 3066 | - | ||
| 3067 | - | func (_c *MockPermissionRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) error) *MockPermissionRepository_Delete_Call { | |
| 3068 | - | _c.Call.Return(run) | |
| 3069 | - | return _c | |
| 3070 | - | } | |
| 3071 | - | ||
| 3072 | - | // Get provides a mock function for the type MockPermissionRepository | |
| 3073 | - | func (_mock *MockPermissionRepository) Get(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error) { | |
| 3074 | - | ret := _mock.Called(ctx, origin, permType) | |
| 3075 | - | ||
| 3076 | - | if len(ret) == 0 { | |
| 3077 | - | panic("no return value specified for Get") | |
| 3078 | - | } | |
| 3079 | - | ||
| 3080 | - | var r0 *entity.PermissionRecord | |
| 3081 | - | var r1 error | |
| 3082 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) (*entity.PermissionRecord, error)); ok { | |
| 3083 | - | return returnFunc(ctx, origin, permType) | |
| 3084 | - | } | |
| 3085 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) *entity.PermissionRecord); ok { | |
| 3086 | - | r0 = returnFunc(ctx, origin, permType) | |
| 3087 | - | } else { | |
| 3088 | - | if ret.Get(0) != nil { | |
| 3089 | - | r0 = ret.Get(0).(*entity.PermissionRecord) | |
| 3090 | - | } | |
| 3091 | - | } | |
| 3092 | - | if returnFunc, ok := ret.Get(1).(func(context.Context, string, entity.PermissionType) error); ok { | |
| 3093 | - | r1 = returnFunc(ctx, origin, permType) | |
| 3094 | - | } else { | |
| 3095 | - | r1 = ret.Error(1) | |
| 3096 | - | } | |
| 3097 | - | return r0, r1 | |
| 3098 | - | } | |
| 3099 | - | ||
| 3100 | - | // MockPermissionRepository_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' | |
| 3101 | - | type MockPermissionRepository_Get_Call struct { | |
| 3102 | - | *mock.Call | |
| 3103 | - | } | |
| 3104 | - | ||
| 3105 | - | // Get is a helper method to define mock.On call | |
| 3106 | - | // - ctx context.Context | |
| 3107 | - | // - origin string | |
| 3108 | - | // - permType entity.PermissionType | |
| 3109 | - | func (_e *MockPermissionRepository_Expecter) Get(ctx interface{}, origin interface{}, permType interface{}) *MockPermissionRepository_Get_Call { | |
| 3110 | - | return &MockPermissionRepository_Get_Call{Call: _e.mock.On("Get", ctx, origin, permType)} | |
| 3111 | - | } | |
| 3112 | - | ||
| 3113 | - | func (_c *MockPermissionRepository_Get_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_Get_Call { | |
| 3114 | - | _c.Call.Run(func(args mock.Arguments) { | |
| 3115 | - | var arg0 context.Context | |
| 3116 | - | if args[0] != nil { | |
| 3117 | - | arg0 = args[0].(context.Context) | |
| 3118 | - | } | |
| 3119 | - | var arg1 string | |
| 3120 | - | if args[1] != nil { | |
| 3121 | - | arg1 = args[1].(string) | |
| 3122 | - | } | |
| 3123 | - | var arg2 entity.PermissionType | |
| 3124 | - | if args[2] != nil { | |
| 3125 | - | arg2 = args[2].(entity.PermissionType) | |
| 3126 | - | } | |
| 3127 | - | run( | |
| 3128 | - | arg0, | |
| 3129 | - | arg1, | |
| 3130 | - | arg2, | |
| 3131 | - | ) | |
| 3132 | - | }) | |
| 3133 | - | return _c | |
| 3134 | - | } | |
| 3135 | - | ||
| 3136 | - | func (_c *MockPermissionRepository_Get_Call) Return(permissionRecord *entity.PermissionRecord, err error) *MockPermissionRepository_Get_Call { | |
| 3137 | - | _c.Call.Return(permissionRecord, err) | |
| 3138 | - | return _c | |
| 3139 | - | } | |
| 3140 | - | ||
| 3141 | - | func (_c *MockPermissionRepository_Get_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error)) *MockPermissionRepository_Get_Call { | |
| 3142 | - | _c.Call.Return(run) | |
| 3143 | - | return _c | |
| 3144 | - | } | |
| 3145 | - | ||
| 3146 | - | // GetAll provides a mock function for the type MockPermissionRepository | |
| 3147 | - | func (_mock *MockPermissionRepository) GetAll(ctx context.Context, origin string) ([]*entity.PermissionRecord, error) { | |
| 3148 | - | ret := _mock.Called(ctx, origin) | |
| 3149 | - | ||
| 3150 | - | if len(ret) == 0 { | |
| 3151 | - | panic("no return value specified for GetAll") | |
| 3152 | - | } | |
| 3153 | - | ||
| 3154 | - | var r0 []*entity.PermissionRecord | |
| 3155 | - | var r1 error | |
| 3156 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]*entity.PermissionRecord, error)); ok { | |
| 3157 | - | return returnFunc(ctx, origin) | |
| 3158 | - | } | |
| 3159 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string) []*entity.PermissionRecord); ok { | |
| 3160 | - | r0 = returnFunc(ctx, origin) | |
| 3161 | - | } else { | |
| 3162 | - | if ret.Get(0) != nil { | |
| 3163 | - | r0 = ret.Get(0).([]*entity.PermissionRecord) | |
| 3164 | - | } | |
| 3165 | - | } | |
| 3166 | - | if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { | |
| 3167 | - | r1 = returnFunc(ctx, origin) | |
| 3168 | - | } else { | |
| 3169 | - | r1 = ret.Error(1) | |
| 3170 | - | } | |
| 3171 | - | return r0, r1 | |
| 3172 | - | } | |
| 3173 | - | ||
| 3174 | - | // MockPermissionRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll' | |
| 3175 | - | type MockPermissionRepository_GetAll_Call struct { | |
| 3176 | - | *mock.Call | |
| 3177 | - | } | |
| 3178 | - | ||
| 3179 | - | // GetAll is a helper method to define mock.On call | |
| 3180 | - | // - ctx context.Context | |
| 3181 | - | // - origin string | |
| 3182 | - | func (_e *MockPermissionRepository_Expecter) GetAll(ctx interface{}, origin interface{}) *MockPermissionRepository_GetAll_Call { | |
| 3183 | - | return &MockPermissionRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx, origin)} | |
| 3184 | - | } | |
| 3185 | - | ||
| 3186 | - | func (_c *MockPermissionRepository_GetAll_Call) Run(run func(ctx context.Context, origin string)) *MockPermissionRepository_GetAll_Call { | |
| 3187 | - | _c.Call.Run(func(args mock.Arguments) { | |
| 3188 | - | var arg0 context.Context | |
| 3189 | - | if args[0] != nil { | |
| 3190 | - | arg0 = args[0].(context.Context) | |
| 3191 | - | } | |
| 3192 | - | var arg1 string | |
| 3193 | - | if args[1] != nil { | |
| 3194 | - | arg1 = args[1].(string) | |
| 3195 | - | } | |
| 3196 | - | run( | |
| 3197 | - | arg0, | |
| 3198 | - | arg1, | |
| 3199 | - | ) | |
| 3200 | - | }) | |
| 3201 | - | return _c | |
| 3202 | - | } | |
| 3203 | - | ||
| 3204 | - | func (_c *MockPermissionRepository_GetAll_Call) Return(permissionRecords []*entity.PermissionRecord, err error) *MockPermissionRepository_GetAll_Call { | |
| 3205 | - | _c.Call.Return(permissionRecords, err) | |
| 3206 | - | return _c | |
| 3207 | - | } | |
| 3208 | - | ||
| 3209 | - | func (_c *MockPermissionRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context, origin string) ([]*entity.PermissionRecord, error)) *MockPermissionRepository_GetAll_Call { | |
| 3210 | - | _c.Call.Return(run) | |
| 3211 | - | return _c | |
| 3212 | - | } | |
| 3213 | - | ||
| 3214 | - | // Set provides a mock function for the type MockPermissionRepository | |
| 3215 | - | func (_mock *MockPermissionRepository) Set(ctx context.Context, record *entity.PermissionRecord) error { | |
| 3216 | - | ret := _mock.Called(ctx, record) | |
| 3217 | - | ||
| 3218 | - | if len(ret) == 0 { | |
| 3219 | - | panic("no return value specified for Set") | |
| 3220 | - | } | |
| 3221 | - | ||
| 3222 | - | var r0 error | |
| 3223 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.PermissionRecord) error); ok { | |
| 3224 | - | r0 = returnFunc(ctx, record) | |
| 3225 | - | } else { | |
| 3226 | - | r0 = ret.Error(0) | |
| 3227 | - | } | |
| 3228 | - | return r0 | |
| 3229 | - | } | |
| 3230 | - | ||
| 3231 | - | // MockPermissionRepository_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' | |
| 3232 | - | type MockPermissionRepository_Set_Call struct { | |
| 3233 | - | *mock.Call | |
| 3234 | - | } | |
| 3235 | - | ||
| 3236 | - | // Set is a helper method to define mock.On call | |
| 3237 | - | // - ctx context.Context | |
| 3238 | - | // - record *entity.PermissionRecord | |
| 3239 | - | func (_e *MockPermissionRepository_Expecter) Set(ctx interface{}, record interface{}) *MockPermissionRepository_Set_Call { | |
| 3240 | - | return &MockPermissionRepository_Set_Call{Call: _e.mock.On("Set", ctx, record)} | |
| 3241 | - | } | |
| 3242 | - | ||
| 3243 | - | func (_c *MockPermissionRepository_Set_Call) Run(run func(ctx context.Context, record *entity.PermissionRecord)) *MockPermissionRepository_Set_Call { | |
| 3244 | - | _c.Call.Run(func(args mock.Arguments) { | |
| 3245 | - | var arg0 context.Context | |
| 3246 | - | if args[0] != nil { | |
| 3247 | - | arg0 = args[0].(context.Context) | |
| 3248 | - | } | |
| 3249 | - | var arg1 *entity.PermissionRecord | |
| 3250 | - | if args[1] != nil { | |
| 3251 | - | arg1 = args[1].(*entity.PermissionRecord) | |
| 3252 | - | } | |
| 3253 | - | run( | |
| 3254 | - | arg0, | |
| 3255 | - | arg1, | |
| 3256 | - | ) | |
| 3257 | - | }) | |
| 3258 | - | return _c | |
| 3259 | - | } | |
| 3260 | - | ||
| 3261 | - | func (_c *MockPermissionRepository_Set_Call) Return(err error) *MockPermissionRepository_Set_Call { | |
| 3262 | - | _c.Call.Return(err) | |
| 3263 | - | return _c | |
| 3264 | - | } | |
| 3265 | - | ||
| 3266 | - | func (_c *MockPermissionRepository_Set_Call) RunAndReturn(run func(ctx context.Context, record *entity.PermissionRecord) error) *MockPermissionRepository_Set_Call { | |
| 3267 | - | _c.Call.Return(run) | |
| 3268 | - | return _c | |
| 3269 | - | } | |
| 3270 | - | ||
| 3271 | 2982 | // NewMockSessionRepository creates a new instance of MockSessionRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 3272 | 2983 | // The first argument is typically a *testing.T value. | |
| 3273 | 2984 | func NewMockSessionRepository(t interface { | |
| @@ -2979,295 +2979,6 @@ func (_c *MockHistoryRepository_Search_Call) RunAndReturn(run func(ctx context.C | |||||
| 2979 | return _c | 2979 | return _c | ||
| 2980 | } | 2980 | } | ||
| 2981 | 2981 | ||||
| 2982 | - | // NewMockPermissionRepository creates a new instance of MockPermissionRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |||
| 2983 | - | // The first argument is typically a *testing.T value. | |||
| 2984 | - | func NewMockPermissionRepository(t interface { | |||
| 2985 | - | mock.TestingT | |||
| 2986 | - | Cleanup(func()) | |||
| 2987 | - | }) *MockPermissionRepository { | |||
| 2988 | - | mock := &MockPermissionRepository{} | |||
| 2989 | - | mock.Mock.Test(t) | |||
| 2990 | - | ||||
| 2991 | - | t.Cleanup(func() { mock.AssertExpectations(t) }) | |||
| 2992 | - | ||||
| 2993 | - | return mock | |||
| 2994 | - | } | |||
| 2995 | - | ||||
| 2996 | - | // MockPermissionRepository is an autogenerated mock type for the PermissionRepository type | |||
| 2997 | - | type MockPermissionRepository struct { | |||
| 2998 | - | mock.Mock | |||
| 2999 | - | } | |||
| 3000 | - | ||||
| 3001 | - | type MockPermissionRepository_Expecter struct { | |||
| 3002 | - | mock *mock.Mock | |||
| 3003 | - | } | |||
| 3004 | - | ||||
| 3005 | - | func (_m *MockPermissionRepository) EXPECT() *MockPermissionRepository_Expecter { | |||
| 3006 | - | return &MockPermissionRepository_Expecter{mock: &_m.Mock} | |||
| 3007 | - | } | |||
| 3008 | - | ||||
| 3009 | - | // Delete provides a mock function for the type MockPermissionRepository | |||
| 3010 | - | func (_mock *MockPermissionRepository) Delete(ctx context.Context, origin string, permType entity.PermissionType) error { | |||
| 3011 | - | ret := _mock.Called(ctx, origin, permType) | |||
| 3012 | - | ||||
| 3013 | - | if len(ret) == 0 { | |||
| 3014 | - | panic("no return value specified for Delete") | |||
| 3015 | - | } | |||
| 3016 | - | ||||
| 3017 | - | var r0 error | |||
| 3018 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) error); ok { | |||
| 3019 | - | r0 = returnFunc(ctx, origin, permType) | |||
| 3020 | - | } else { | |||
| 3021 | - | r0 = ret.Error(0) | |||
| 3022 | - | } | |||
| 3023 | - | return r0 | |||
| 3024 | - | } | |||
| 3025 | - | ||||
| 3026 | - | // MockPermissionRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' | |||
| 3027 | - | type MockPermissionRepository_Delete_Call struct { | |||
| 3028 | - | *mock.Call | |||
| 3029 | - | } | |||
| 3030 | - | ||||
| 3031 | - | // Delete is a helper method to define mock.On call | |||
| 3032 | - | // - ctx context.Context | |||
| 3033 | - | // - origin string | |||
| 3034 | - | // - permType entity.PermissionType | |||
| 3035 | - | func (_e *MockPermissionRepository_Expecter) Delete(ctx interface{}, origin interface{}, permType interface{}) *MockPermissionRepository_Delete_Call { | |||
| 3036 | - | return &MockPermissionRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, origin, permType)} | |||
| 3037 | - | } | |||
| 3038 | - | ||||
| 3039 | - | func (_c *MockPermissionRepository_Delete_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_Delete_Call { | |||
| 3040 | - | _c.Call.Run(func(args mock.Arguments) { | |||
| 3041 | - | var arg0 context.Context | |||
| 3042 | - | if args[0] != nil { | |||
| 3043 | - | arg0 = args[0].(context.Context) | |||
| 3044 | - | } | |||
| 3045 | - | var arg1 string | |||
| 3046 | - | if args[1] != nil { | |||
| 3047 | - | arg1 = args[1].(string) | |||
| 3048 | - | } | |||
| 3049 | - | var arg2 entity.PermissionType | |||
| 3050 | - | if args[2] != nil { | |||
| 3051 | - | arg2 = args[2].(entity.PermissionType) | |||
| 3052 | - | } | |||
| 3053 | - | run( | |||
| 3054 | - | arg0, | |||
| 3055 | - | arg1, | |||
| 3056 | - | arg2, | |||
| 3057 | - | ) | |||
| 3058 | - | }) | |||
| 3059 | - | return _c | |||
| 3060 | - | } | |||
| 3061 | - | ||||
| 3062 | - | func (_c *MockPermissionRepository_Delete_Call) Return(err error) *MockPermissionRepository_Delete_Call { | |||
| 3063 | - | _c.Call.Return(err) | |||
| 3064 | - | return _c | |||
| 3065 | - | } | |||
| 3066 | - | ||||
| 3067 | - | func (_c *MockPermissionRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) error) *MockPermissionRepository_Delete_Call { | |||
| 3068 | - | _c.Call.Return(run) | |||
| 3069 | - | return _c | |||
| 3070 | - | } | |||
| 3071 | - | ||||
| 3072 | - | // Get provides a mock function for the type MockPermissionRepository | |||
| 3073 | - | func (_mock *MockPermissionRepository) Get(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error) { | |||
| 3074 | - | ret := _mock.Called(ctx, origin, permType) | |||
| 3075 | - | ||||
| 3076 | - | if len(ret) == 0 { | |||
| 3077 | - | panic("no return value specified for Get") | |||
| 3078 | - | } | |||
| 3079 | - | ||||
| 3080 | - | var r0 *entity.PermissionRecord | |||
| 3081 | - | var r1 error | |||
| 3082 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) (*entity.PermissionRecord, error)); ok { | |||
| 3083 | - | return returnFunc(ctx, origin, permType) | |||
| 3084 | - | } | |||
| 3085 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) *entity.PermissionRecord); ok { | |||
| 3086 | - | r0 = returnFunc(ctx, origin, permType) | |||
| 3087 | - | } else { | |||
| 3088 | - | if ret.Get(0) != nil { | |||
| 3089 | - | r0 = ret.Get(0).(*entity.PermissionRecord) | |||
| 3090 | - | } | |||
| 3091 | - | } | |||
| 3092 | - | if returnFunc, ok := ret.Get(1).(func(context.Context, string, entity.PermissionType) error); ok { | |||
| 3093 | - | r1 = returnFunc(ctx, origin, permType) | |||
| 3094 | - | } else { | |||
| 3095 | - | r1 = ret.Error(1) | |||
| 3096 | - | } | |||
| 3097 | - | return r0, r1 | |||
| 3098 | - | } | |||
| 3099 | - | ||||
| 3100 | - | // MockPermissionRepository_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' | |||
| 3101 | - | type MockPermissionRepository_Get_Call struct { | |||
| 3102 | - | *mock.Call | |||
| 3103 | - | } | |||
| 3104 | - | ||||
| 3105 | - | // Get is a helper method to define mock.On call | |||
| 3106 | - | // - ctx context.Context | |||
| 3107 | - | // - origin string | |||
| 3108 | - | // - permType entity.PermissionType | |||
| 3109 | - | func (_e *MockPermissionRepository_Expecter) Get(ctx interface{}, origin interface{}, permType interface{}) *MockPermissionRepository_Get_Call { | |||
| 3110 | - | return &MockPermissionRepository_Get_Call{Call: _e.mock.On("Get", ctx, origin, permType)} | |||
| 3111 | - | } | |||
| 3112 | - | ||||
| 3113 | - | func (_c *MockPermissionRepository_Get_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_Get_Call { | |||
| 3114 | - | _c.Call.Run(func(args mock.Arguments) { | |||
| 3115 | - | var arg0 context.Context | |||
| 3116 | - | if args[0] != nil { | |||
| 3117 | - | arg0 = args[0].(context.Context) | |||
| 3118 | - | } | |||
| 3119 | - | var arg1 string | |||
| 3120 | - | if args[1] != nil { | |||
| 3121 | - | arg1 = args[1].(string) | |||
| 3122 | - | } | |||
| 3123 | - | var arg2 entity.PermissionType | |||
| 3124 | - | if args[2] != nil { | |||
| 3125 | - | arg2 = args[2].(entity.PermissionType) | |||
| 3126 | - | } | |||
| 3127 | - | run( | |||
| 3128 | - | arg0, | |||
| 3129 | - | arg1, | |||
| 3130 | - | arg2, | |||
| 3131 | - | ) | |||
| 3132 | - | }) | |||
| 3133 | - | return _c | |||
| 3134 | - | } | |||
| 3135 | - | ||||
| 3136 | - | func (_c *MockPermissionRepository_Get_Call) Return(permissionRecord *entity.PermissionRecord, err error) *MockPermissionRepository_Get_Call { | |||
| 3137 | - | _c.Call.Return(permissionRecord, err) | |||
| 3138 | - | return _c | |||
| 3139 | - | } | |||
| 3140 | - | ||||
| 3141 | - | func (_c *MockPermissionRepository_Get_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error)) *MockPermissionRepository_Get_Call { | |||
| 3142 | - | _c.Call.Return(run) | |||
| 3143 | - | return _c | |||
| 3144 | - | } | |||
| 3145 | - | ||||
| 3146 | - | // GetAll provides a mock function for the type MockPermissionRepository | |||
| 3147 | - | func (_mock *MockPermissionRepository) GetAll(ctx context.Context, origin string) ([]*entity.PermissionRecord, error) { | |||
| 3148 | - | ret := _mock.Called(ctx, origin) | |||
| 3149 | - | ||||
| 3150 | - | if len(ret) == 0 { | |||
| 3151 | - | panic("no return value specified for GetAll") | |||
| 3152 | - | } | |||
| 3153 | - | ||||
| 3154 | - | var r0 []*entity.PermissionRecord | |||
| 3155 | - | var r1 error | |||
| 3156 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]*entity.PermissionRecord, error)); ok { | |||
| 3157 | - | return returnFunc(ctx, origin) | |||
| 3158 | - | } | |||
| 3159 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, string) []*entity.PermissionRecord); ok { | |||
| 3160 | - | r0 = returnFunc(ctx, origin) | |||
| 3161 | - | } else { | |||
| 3162 | - | if ret.Get(0) != nil { | |||
| 3163 | - | r0 = ret.Get(0).([]*entity.PermissionRecord) | |||
| 3164 | - | } | |||
| 3165 | - | } | |||
| 3166 | - | if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { | |||
| 3167 | - | r1 = returnFunc(ctx, origin) | |||
| 3168 | - | } else { | |||
| 3169 | - | r1 = ret.Error(1) | |||
| 3170 | - | } | |||
| 3171 | - | return r0, r1 | |||
| 3172 | - | } | |||
| 3173 | - | ||||
| 3174 | - | // MockPermissionRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll' | |||
| 3175 | - | type MockPermissionRepository_GetAll_Call struct { | |||
| 3176 | - | *mock.Call | |||
| 3177 | - | } | |||
| 3178 | - | ||||
| 3179 | - | // GetAll is a helper method to define mock.On call | |||
| 3180 | - | // - ctx context.Context | |||
| 3181 | - | // - origin string | |||
| 3182 | - | func (_e *MockPermissionRepository_Expecter) GetAll(ctx interface{}, origin interface{}) *MockPermissionRepository_GetAll_Call { | |||
| 3183 | - | return &MockPermissionRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx, origin)} | |||
| 3184 | - | } | |||
| 3185 | - | ||||
| 3186 | - | func (_c *MockPermissionRepository_GetAll_Call) Run(run func(ctx context.Context, origin string)) *MockPermissionRepository_GetAll_Call { | |||
| 3187 | - | _c.Call.Run(func(args mock.Arguments) { | |||
| 3188 | - | var arg0 context.Context | |||
| 3189 | - | if args[0] != nil { | |||
| 3190 | - | arg0 = args[0].(context.Context) | |||
| 3191 | - | } | |||
| 3192 | - | var arg1 string | |||
| 3193 | - | if args[1] != nil { | |||
| 3194 | - | arg1 = args[1].(string) | |||
| 3195 | - | } | |||
| 3196 | - | run( | |||
| 3197 | - | arg0, | |||
| 3198 | - | arg1, | |||
| 3199 | - | ) | |||
| 3200 | - | }) | |||
| 3201 | - | return _c | |||
| 3202 | - | } | |||
| 3203 | - | ||||
| 3204 | - | func (_c *MockPermissionRepository_GetAll_Call) Return(permissionRecords []*entity.PermissionRecord, err error) *MockPermissionRepository_GetAll_Call { | |||
| 3205 | - | _c.Call.Return(permissionRecords, err) | |||
| 3206 | - | return _c | |||
| 3207 | - | } | |||
| 3208 | - | ||||
| 3209 | - | func (_c *MockPermissionRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context, origin string) ([]*entity.PermissionRecord, error)) *MockPermissionRepository_GetAll_Call { | |||
| 3210 | - | _c.Call.Return(run) | |||
| 3211 | - | return _c | |||
| 3212 | - | } | |||
| 3213 | - | ||||
| 3214 | - | // Set provides a mock function for the type MockPermissionRepository | |||
| 3215 | - | func (_mock *MockPermissionRepository) Set(ctx context.Context, record *entity.PermissionRecord) error { | |||
| 3216 | - | ret := _mock.Called(ctx, record) | |||
| 3217 | - | ||||
| 3218 | - | if len(ret) == 0 { | |||
| 3219 | - | panic("no return value specified for Set") | |||
| 3220 | - | } | |||
| 3221 | - | ||||
| 3222 | - | var r0 error | |||
| 3223 | - | if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.PermissionRecord) error); ok { | |||
| 3224 | - | r0 = returnFunc(ctx, record) | |||
| 3225 | - | } else { | |||
| 3226 | - | r0 = ret.Error(0) | |||
| 3227 | - | } | |||
| 3228 | - | return r0 | |||
| 3229 | - | } | |||
| 3230 | - | ||||
| 3231 | - | // MockPermissionRepository_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' | |||
| 3232 | - | type MockPermissionRepository_Set_Call struct { | |||
| 3233 | - | *mock.Call | |||
| 3234 | - | } | |||
| 3235 | - | ||||
| 3236 | - | // Set is a helper method to define mock.On call | |||
| 3237 | - | // - ctx context.Context | |||
| 3238 | - | // - record *entity.PermissionRecord | |||
| 3239 | - | func (_e *MockPermissionRepository_Expecter) Set(ctx interface{}, record interface{}) *MockPermissionRepository_Set_Call { | |||
| 3240 | - | return &MockPermissionRepository_Set_Call{Call: _e.mock.On("Set", ctx, record)} | |||
| 3241 | - | } | |||
| 3242 | - | ||||
| 3243 | - | func (_c *MockPermissionRepository_Set_Call) Run(run func(ctx context.Context, record *entity.PermissionRecord)) *MockPermissionRepository_Set_Call { | |||
| 3244 | - | _c.Call.Run(func(args mock.Arguments) { | |||
| 3245 | - | var arg0 context.Context | |||
| 3246 | - | if args[0] != nil { | |||
| 3247 | - | arg0 = args[0].(context.Context) | |||
| 3248 | - | } | |||
| 3249 | - | var arg1 *entity.PermissionRecord | |||
| 3250 | - | if args[1] != nil { | |||
| 3251 | - | arg1 = args[1].(*entity.PermissionRecord) | |||
| 3252 | - | } | |||
| 3253 | - | run( | |||
| 3254 | - | arg0, | |||
| 3255 | - | arg1, | |||
| 3256 | - | ) | |||
| 3257 | - | }) | |||
| 3258 | - | return _c | |||
| 3259 | - | } | |||
| 3260 | - | ||||
| 3261 | - | func (_c *MockPermissionRepository_Set_Call) Return(err error) *MockPermissionRepository_Set_Call { | |||
| 3262 | - | _c.Call.Return(err) | |||
| 3263 | - | return _c | |||
| 3264 | - | } | |||
| 3265 | - | ||||
| 3266 | - | func (_c *MockPermissionRepository_Set_Call) RunAndReturn(run func(ctx context.Context, record *entity.PermissionRecord) error) *MockPermissionRepository_Set_Call { | |||
| 3267 | - | _c.Call.Return(run) | |||
| 3268 | - | return _c | |||
| 3269 | - | } | |||
| 3270 | - | ||||
| 3271 | // NewMockSessionRepository creates a new instance of MockSessionRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | 2982 | // NewMockSessionRepository creates a new instance of MockSessionRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | ||
| 3272 | // The first argument is typically a *testing.T value. | 2983 | // The first argument is typically a *testing.T value. | ||
| 3273 | func NewMockSessionRepository(t interface { | 2984 | func NewMockSessionRepository(t interface { | ||