detached bf18ec0

chore(permission): add mocks and update configuration

Add PermissionRepository and PermissionDialogPresenter mocks via mockery.
Update .mockery.yaml with new mock targets.
Add AGENTS.md commands section for pre-commit checks.
Add PermissionTypesToStrings helper to entity package.
commit
bf18ec08e2fb9c1356a30c75a03f9dbc4b719971
author
brice · · 2026-01-30 05:01 UTC
committer
brice · · 2026-02-07 11:58 UTC
parent
ef3f82a
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
4 files · +386 -0
M .mockery.yaml +2 -0
@@ -31,6 +31,7 @@ packages:
3131 KeybindingsProvider: {}
3232 KeybindingsSaver: {}
3333 DownloadResponse: {}
34+ PermissionDialogPresenter: {}
3435 github.com/bnema/dumber/internal/domain/repository:
3536 config:
3637 dir: '{{.InterfaceDir}}/mocks'
@@ -45,6 +46,7 @@ packages:
4546 SessionStateRepository: {}
4647 TagRepository: {}
4748 ZoomRepository: {}
49+ PermissionRepository: {}
4850 github.com/bnema/dumber/internal/infrastructure/filtering:
4951 config:
5052 dir: '{{.InterfaceDir}}/mocks'
@@ -31,6 +31,7 @@ packages:
31 KeybindingsProvider: {}31 KeybindingsProvider: {}
32 KeybindingsSaver: {}32 KeybindingsSaver: {}
33 DownloadResponse: {}33 DownloadResponse: {}
34+ PermissionDialogPresenter: {}
34 github.com/bnema/dumber/internal/domain/repository:35 github.com/bnema/dumber/internal/domain/repository:
35 config:36 config:
36 dir: '{{.InterfaceDir}}/mocks'37 dir: '{{.InterfaceDir}}/mocks'
@@ -45,6 +46,7 @@ packages:
45 SessionStateRepository: {}46 SessionStateRepository: {}
46 TagRepository: {}47 TagRepository: {}
47 ZoomRepository: {}48 ZoomRepository: {}
49+ PermissionRepository: {}
48 github.com/bnema/dumber/internal/infrastructure/filtering:50 github.com/bnema/dumber/internal/infrastructure/filtering:
49 config:51 config:
50 dir: '{{.InterfaceDir}}/mocks'52 dir: '{{.InterfaceDir}}/mocks'
M AGENTS.md +10 -0
@@ -31,3 +31,13 @@
3131
3232 ## Commands
3333
34+Run before committing:
35+- `make lint` - golangci-lint
36+- `make test` - unit tests
37+- `make check` - verify build, tests, tools
38+- `go fmt ./...` - format code
39+
40+## Misc
41+
42+- vendor dir is gitignored
43+
@@ -31,3 +31,13 @@
31 31
32 ## Commands32 ## Commands
33 33
34+Run before committing:
35+- `make lint` - golangci-lint
36+- `make test` - unit tests
37+- `make check` - verify build, tests, tools
38+- `go fmt ./...` - format code
39+
40+## Misc
41+
42+- vendor dir is gitignored
43+
M internal/application/port/mocks/mocks.go +85 -0
@@ -2140,6 +2140,91 @@ func (_c *MockKeybindingsSaver_SetKeybinding_Call) RunAndReturn(run func(ctx con
21402140 return _c
21412141 }
21422142
2143+// NewMockPermissionDialogPresenter creates a new instance of MockPermissionDialogPresenter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
2144+// The first argument is typically a *testing.T value.
2145+func NewMockPermissionDialogPresenter(t interface {
2146+ mock.TestingT
2147+ Cleanup(func())
2148+}) *MockPermissionDialogPresenter {
2149+ mock := &MockPermissionDialogPresenter{}
2150+ mock.Mock.Test(t)
2151+
2152+ t.Cleanup(func() { mock.AssertExpectations(t) })
2153+
2154+ return mock
2155+}
2156+
2157+// MockPermissionDialogPresenter is an autogenerated mock type for the PermissionDialogPresenter type
2158+type MockPermissionDialogPresenter struct {
2159+ mock.Mock
2160+}
2161+
2162+type MockPermissionDialogPresenter_Expecter struct {
2163+ mock *mock.Mock
2164+}
2165+
2166+func (_m *MockPermissionDialogPresenter) EXPECT() *MockPermissionDialogPresenter_Expecter {
2167+ return &MockPermissionDialogPresenter_Expecter{mock: &_m.Mock}
2168+}
2169+
2170+// ShowPermissionDialog provides a mock function for the type MockPermissionDialogPresenter
2171+func (_mock *MockPermissionDialogPresenter) ShowPermissionDialog(ctx context.Context, origin string, permTypes []entity.PermissionType, callback func(result port.PermissionDialogResult)) {
2172+ _mock.Called(ctx, origin, permTypes, callback)
2173+ return
2174+}
2175+
2176+// MockPermissionDialogPresenter_ShowPermissionDialog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShowPermissionDialog'
2177+type MockPermissionDialogPresenter_ShowPermissionDialog_Call struct {
2178+ *mock.Call
2179+}
2180+
2181+// ShowPermissionDialog is a helper method to define mock.On call
2182+// - ctx context.Context
2183+// - origin string
2184+// - permTypes []entity.PermissionType
2185+// - callback func(result port.PermissionDialogResult)
2186+func (_e *MockPermissionDialogPresenter_Expecter) ShowPermissionDialog(ctx interface{}, origin interface{}, permTypes interface{}, callback interface{}) *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
2187+ return &MockPermissionDialogPresenter_ShowPermissionDialog_Call{Call: _e.mock.On("ShowPermissionDialog", ctx, origin, permTypes, callback)}
2188+}
2189+
2190+func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) Run(run func(ctx context.Context, origin string, permTypes []entity.PermissionType, callback func(result port.PermissionDialogResult))) *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
2191+ _c.Call.Run(func(args mock.Arguments) {
2192+ var arg0 context.Context
2193+ if args[0] != nil {
2194+ arg0 = args[0].(context.Context)
2195+ }
2196+ var arg1 string
2197+ if args[1] != nil {
2198+ arg1 = args[1].(string)
2199+ }
2200+ var arg2 []entity.PermissionType
2201+ if args[2] != nil {
2202+ arg2 = args[2].([]entity.PermissionType)
2203+ }
2204+ var arg3 func(result port.PermissionDialogResult)
2205+ if args[3] != nil {
2206+ arg3 = args[3].(func(result port.PermissionDialogResult))
2207+ }
2208+ run(
2209+ arg0,
2210+ arg1,
2211+ arg2,
2212+ arg3,
2213+ )
2214+ })
2215+ return _c
2216+}
2217+
2218+func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) Return() *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
2219+ _c.Call.Return()
2220+ return _c
2221+}
2222+
2223+func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) RunAndReturn(run func(ctx context.Context, origin string, permTypes []entity.PermissionType, callback func(result port.PermissionDialogResult))) *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
2224+ _c.Run(run)
2225+ return _c
2226+}
2227+
21432228 // 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.
21442229 // The first argument is typically a *testing.T value.
21452230 func NewMockSessionLogger(t interface {
@@ -2140,6 +2140,91 @@ func (_c *MockKeybindingsSaver_SetKeybinding_Call) RunAndReturn(run func(ctx con
2140 return _c2140 return _c
2141 }2141 }
2142 2142
2143+// NewMockPermissionDialogPresenter creates a new instance of MockPermissionDialogPresenter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
2144+// The first argument is typically a *testing.T value.
2145+func NewMockPermissionDialogPresenter(t interface {
2146+ mock.TestingT
2147+ Cleanup(func())
2148+}) *MockPermissionDialogPresenter {
2149+ mock := &MockPermissionDialogPresenter{}
2150+ mock.Mock.Test(t)
2151+
2152+ t.Cleanup(func() { mock.AssertExpectations(t) })
2153+
2154+ return mock
2155+}
2156+
2157+// MockPermissionDialogPresenter is an autogenerated mock type for the PermissionDialogPresenter type
2158+type MockPermissionDialogPresenter struct {
2159+ mock.Mock
2160+}
2161+
2162+type MockPermissionDialogPresenter_Expecter struct {
2163+ mock *mock.Mock
2164+}
2165+
2166+func (_m *MockPermissionDialogPresenter) EXPECT() *MockPermissionDialogPresenter_Expecter {
2167+ return &MockPermissionDialogPresenter_Expecter{mock: &_m.Mock}
2168+}
2169+
2170+// ShowPermissionDialog provides a mock function for the type MockPermissionDialogPresenter
2171+func (_mock *MockPermissionDialogPresenter) ShowPermissionDialog(ctx context.Context, origin string, permTypes []entity.PermissionType, callback func(result port.PermissionDialogResult)) {
2172+ _mock.Called(ctx, origin, permTypes, callback)
2173+ return
2174+}
2175+
2176+// MockPermissionDialogPresenter_ShowPermissionDialog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShowPermissionDialog'
2177+type MockPermissionDialogPresenter_ShowPermissionDialog_Call struct {
2178+ *mock.Call
2179+}
2180+
2181+// ShowPermissionDialog is a helper method to define mock.On call
2182+// - ctx context.Context
2183+// - origin string
2184+// - permTypes []entity.PermissionType
2185+// - callback func(result port.PermissionDialogResult)
2186+func (_e *MockPermissionDialogPresenter_Expecter) ShowPermissionDialog(ctx interface{}, origin interface{}, permTypes interface{}, callback interface{}) *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
2187+ return &MockPermissionDialogPresenter_ShowPermissionDialog_Call{Call: _e.mock.On("ShowPermissionDialog", ctx, origin, permTypes, callback)}
2188+}
2189+
2190+func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) Run(run func(ctx context.Context, origin string, permTypes []entity.PermissionType, callback func(result port.PermissionDialogResult))) *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
2191+ _c.Call.Run(func(args mock.Arguments) {
2192+ var arg0 context.Context
2193+ if args[0] != nil {
2194+ arg0 = args[0].(context.Context)
2195+ }
2196+ var arg1 string
2197+ if args[1] != nil {
2198+ arg1 = args[1].(string)
2199+ }
2200+ var arg2 []entity.PermissionType
2201+ if args[2] != nil {
2202+ arg2 = args[2].([]entity.PermissionType)
2203+ }
2204+ var arg3 func(result port.PermissionDialogResult)
2205+ if args[3] != nil {
2206+ arg3 = args[3].(func(result port.PermissionDialogResult))
2207+ }
2208+ run(
2209+ arg0,
2210+ arg1,
2211+ arg2,
2212+ arg3,
2213+ )
2214+ })
2215+ return _c
2216+}
2217+
2218+func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) Return() *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
2219+ _c.Call.Return()
2220+ return _c
2221+}
2222+
2223+func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) RunAndReturn(run func(ctx context.Context, origin string, permTypes []entity.PermissionType, callback func(result port.PermissionDialogResult))) *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
2224+ _c.Run(run)
2225+ return _c
2226+}
2227+
2143 // 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.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.
2144 // The first argument is typically a *testing.T value.2229 // The first argument is typically a *testing.T value.
2145 func NewMockSessionLogger(t interface {2230 func NewMockSessionLogger(t interface {
M internal/domain/repository/mocks/mocks.go +289 -0
@@ -2979,6 +2979,295 @@ func (_c *MockHistoryRepository_Search_Call) RunAndReturn(run func(ctx context.C
29792979 return _c
29802980 }
29812981
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+
29823271 // 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.
29833272 // The first argument is typically a *testing.T value.
29843273 func NewMockSessionRepository(t interface {
@@ -2979,6 +2979,295 @@ func (_c *MockHistoryRepository_Search_Call) RunAndReturn(run func(ctx context.C
2979 return _c2979 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+
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.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.
2983 // The first argument is typically a *testing.T value.3272 // The first argument is typically a *testing.T value.
2984 func NewMockSessionRepository(t interface {3273 func NewMockSessionRepository(t interface {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close