From cd85032ecb2c3196fa2dfa29e4e4e2c84329160d Mon Sep 17 00:00:00 2001 From: devhaozi <115467771+devhaozi@users.noreply.github.com> Date: Mon, 12 Jan 2026 15:31:53 +0000 Subject: [PATCH] chore: update mocks --- mocks/biz/BackupRepo.go | 70 ++++++++++---------- mocks/biz/CertAccountRepo.go | 74 +++++++++++---------- mocks/biz/CertDNSRepo.go | 74 +++++++++++---------- mocks/biz/CertRepo.go | 102 +++++++++++++++-------------- mocks/biz/CronRepo.go | 66 ++++++++++--------- mocks/biz/DatabaseRepo.go | 45 +++++++------ mocks/biz/DatabaseUserRepo.go | 45 +++++++------ mocks/biz/LogRepo.go | 94 +++++++++++++++++++++++++++ mocks/biz/ProjectRepo.go | 76 ++++++++++++---------- mocks/biz/SSHRepo.go | 66 ++++++++++--------- mocks/biz/SafeRepo.go | 48 ++++++++------ mocks/biz/SettingRepo.go | 32 ++++++---- mocks/biz/UserRepo.go | 117 ++++++++++++++++++---------------- mocks/biz/WebHookRepo.go | 74 +++++++++++---------- mocks/biz/WebsiteRepo.go | 71 +++++++++++---------- 15 files changed, 613 insertions(+), 441 deletions(-) create mode 100644 mocks/biz/LogRepo.go diff --git a/mocks/biz/BackupRepo.go b/mocks/biz/BackupRepo.go index 07f0b5a1..28ddfbd3 100644 --- a/mocks/biz/BackupRepo.go +++ b/mocks/biz/BackupRepo.go @@ -3,7 +3,10 @@ package biz import ( + context "context" + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" types "github.com/acepanel/panel/pkg/types" @@ -70,14 +73,14 @@ func (_c *BackupRepo_ClearExpired_Call) RunAndReturn(run func(string, string, in return _c } -// Create provides a mock function with given fields: typ, target, path -func (_m *BackupRepo) Create(typ biz.BackupType, target string, path ...string) error { +// Create provides a mock function with given fields: ctx, typ, target, path +func (_m *BackupRepo) Create(ctx context.Context, typ biz.BackupType, target string, path ...string) error { _va := make([]interface{}, len(path)) for _i := range path { _va[_i] = path[_i] } var _ca []interface{} - _ca = append(_ca, typ, target) + _ca = append(_ca, ctx, typ, target) _ca = append(_ca, _va...) ret := _m.Called(_ca...) @@ -86,8 +89,8 @@ func (_m *BackupRepo) Create(typ biz.BackupType, target string, path ...string) } var r0 error - if rf, ok := ret.Get(0).(func(biz.BackupType, string, ...string) error); ok { - r0 = rf(typ, target, path...) + if rf, ok := ret.Get(0).(func(context.Context, biz.BackupType, string, ...string) error); ok { + r0 = rf(ctx, typ, target, path...) } else { r0 = ret.Error(0) } @@ -101,23 +104,24 @@ type BackupRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - typ biz.BackupType // - target string // - path ...string -func (_e *BackupRepo_Expecter) Create(typ interface{}, target interface{}, path ...interface{}) *BackupRepo_Create_Call { +func (_e *BackupRepo_Expecter) Create(ctx interface{}, typ interface{}, target interface{}, path ...interface{}) *BackupRepo_Create_Call { return &BackupRepo_Create_Call{Call: _e.mock.On("Create", - append([]interface{}{typ, target}, path...)...)} + append([]interface{}{ctx, typ, target}, path...)...)} } -func (_c *BackupRepo_Create_Call) Run(run func(typ biz.BackupType, target string, path ...string)) *BackupRepo_Create_Call { +func (_c *BackupRepo_Create_Call) Run(run func(ctx context.Context, typ biz.BackupType, target string, path ...string)) *BackupRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]string, len(args)-2) - for i, a := range args[2:] { + variadicArgs := make([]string, len(args)-3) + for i, a := range args[3:] { if a != nil { variadicArgs[i] = a.(string) } } - run(args[0].(biz.BackupType), args[1].(string), variadicArgs...) + run(args[0].(context.Context), args[1].(biz.BackupType), args[2].(string), variadicArgs...) }) return _c } @@ -127,7 +131,7 @@ func (_c *BackupRepo_Create_Call) Return(_a0 error) *BackupRepo_Create_Call { return _c } -func (_c *BackupRepo_Create_Call) RunAndReturn(run func(biz.BackupType, string, ...string) error) *BackupRepo_Create_Call { +func (_c *BackupRepo_Create_Call) RunAndReturn(run func(context.Context, biz.BackupType, string, ...string) error) *BackupRepo_Create_Call { _c.Call.Return(run) return _c } @@ -179,17 +183,17 @@ func (_c *BackupRepo_CutoffLog_Call) RunAndReturn(run func(string, string) error return _c } -// Delete provides a mock function with given fields: typ, name -func (_m *BackupRepo) Delete(typ biz.BackupType, name string) error { - ret := _m.Called(typ, name) +// Delete provides a mock function with given fields: ctx, typ, name +func (_m *BackupRepo) Delete(ctx context.Context, typ biz.BackupType, name string) error { + ret := _m.Called(ctx, typ, name) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(biz.BackupType, string) error); ok { - r0 = rf(typ, name) + if rf, ok := ret.Get(0).(func(context.Context, biz.BackupType, string) error); ok { + r0 = rf(ctx, typ, name) } else { r0 = ret.Error(0) } @@ -203,15 +207,16 @@ type BackupRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - typ biz.BackupType // - name string -func (_e *BackupRepo_Expecter) Delete(typ interface{}, name interface{}) *BackupRepo_Delete_Call { - return &BackupRepo_Delete_Call{Call: _e.mock.On("Delete", typ, name)} +func (_e *BackupRepo_Expecter) Delete(ctx interface{}, typ interface{}, name interface{}) *BackupRepo_Delete_Call { + return &BackupRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, typ, name)} } -func (_c *BackupRepo_Delete_Call) Run(run func(typ biz.BackupType, name string)) *BackupRepo_Delete_Call { +func (_c *BackupRepo_Delete_Call) Run(run func(ctx context.Context, typ biz.BackupType, name string)) *BackupRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(biz.BackupType), args[1].(string)) + run(args[0].(context.Context), args[1].(biz.BackupType), args[2].(string)) }) return _c } @@ -221,7 +226,7 @@ func (_c *BackupRepo_Delete_Call) Return(_a0 error) *BackupRepo_Delete_Call { return _c } -func (_c *BackupRepo_Delete_Call) RunAndReturn(run func(biz.BackupType, string) error) *BackupRepo_Delete_Call { +func (_c *BackupRepo_Delete_Call) RunAndReturn(run func(context.Context, biz.BackupType, string) error) *BackupRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -385,17 +390,17 @@ func (_c *BackupRepo_List_Call) RunAndReturn(run func(biz.BackupType) ([]*types. return _c } -// Restore provides a mock function with given fields: typ, backup, target -func (_m *BackupRepo) Restore(typ biz.BackupType, backup string, target string) error { - ret := _m.Called(typ, backup, target) +// Restore provides a mock function with given fields: ctx, typ, backup, target +func (_m *BackupRepo) Restore(ctx context.Context, typ biz.BackupType, backup string, target string) error { + ret := _m.Called(ctx, typ, backup, target) if len(ret) == 0 { panic("no return value specified for Restore") } var r0 error - if rf, ok := ret.Get(0).(func(biz.BackupType, string, string) error); ok { - r0 = rf(typ, backup, target) + if rf, ok := ret.Get(0).(func(context.Context, biz.BackupType, string, string) error); ok { + r0 = rf(ctx, typ, backup, target) } else { r0 = ret.Error(0) } @@ -409,16 +414,17 @@ type BackupRepo_Restore_Call struct { } // Restore is a helper method to define mock.On call +// - ctx context.Context // - typ biz.BackupType // - backup string // - target string -func (_e *BackupRepo_Expecter) Restore(typ interface{}, backup interface{}, target interface{}) *BackupRepo_Restore_Call { - return &BackupRepo_Restore_Call{Call: _e.mock.On("Restore", typ, backup, target)} +func (_e *BackupRepo_Expecter) Restore(ctx interface{}, typ interface{}, backup interface{}, target interface{}) *BackupRepo_Restore_Call { + return &BackupRepo_Restore_Call{Call: _e.mock.On("Restore", ctx, typ, backup, target)} } -func (_c *BackupRepo_Restore_Call) Run(run func(typ biz.BackupType, backup string, target string)) *BackupRepo_Restore_Call { +func (_c *BackupRepo_Restore_Call) Run(run func(ctx context.Context, typ biz.BackupType, backup string, target string)) *BackupRepo_Restore_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(biz.BackupType), args[1].(string), args[2].(string)) + run(args[0].(context.Context), args[1].(biz.BackupType), args[2].(string), args[3].(string)) }) return _c } @@ -428,7 +434,7 @@ func (_c *BackupRepo_Restore_Call) Return(_a0 error) *BackupRepo_Restore_Call { return _c } -func (_c *BackupRepo_Restore_Call) RunAndReturn(run func(biz.BackupType, string, string) error) *BackupRepo_Restore_Call { +func (_c *BackupRepo_Restore_Call) RunAndReturn(run func(context.Context, biz.BackupType, string, string) error) *BackupRepo_Restore_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/CertAccountRepo.go b/mocks/biz/CertAccountRepo.go index bc7efba0..df97cabd 100644 --- a/mocks/biz/CertAccountRepo.go +++ b/mocks/biz/CertAccountRepo.go @@ -3,7 +3,10 @@ package biz import ( + context "context" + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" request "github.com/acepanel/panel/internal/http/request" @@ -22,9 +25,9 @@ func (_m *CertAccountRepo) EXPECT() *CertAccountRepo_Expecter { return &CertAccountRepo_Expecter{mock: &_m.Mock} } -// Create provides a mock function with given fields: req -func (_m *CertAccountRepo) Create(req *request.CertAccountCreate) (*biz.CertAccount, error) { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *CertAccountRepo) Create(ctx context.Context, req *request.CertAccountCreate) (*biz.CertAccount, error) { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") @@ -32,19 +35,19 @@ func (_m *CertAccountRepo) Create(req *request.CertAccountCreate) (*biz.CertAcco var r0 *biz.CertAccount var r1 error - if rf, ok := ret.Get(0).(func(*request.CertAccountCreate) (*biz.CertAccount, error)); ok { - return rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertAccountCreate) (*biz.CertAccount, error)); ok { + return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(*request.CertAccountCreate) *biz.CertAccount); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertAccountCreate) *biz.CertAccount); ok { + r0 = rf(ctx, req) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*biz.CertAccount) } } - if rf, ok := ret.Get(1).(func(*request.CertAccountCreate) error); ok { - r1 = rf(req) + if rf, ok := ret.Get(1).(func(context.Context, *request.CertAccountCreate) error); ok { + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -58,14 +61,15 @@ type CertAccountRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.CertAccountCreate -func (_e *CertAccountRepo_Expecter) Create(req interface{}) *CertAccountRepo_Create_Call { - return &CertAccountRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *CertAccountRepo_Expecter) Create(ctx interface{}, req interface{}) *CertAccountRepo_Create_Call { + return &CertAccountRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *CertAccountRepo_Create_Call) Run(run func(req *request.CertAccountCreate)) *CertAccountRepo_Create_Call { +func (_c *CertAccountRepo_Create_Call) Run(run func(ctx context.Context, req *request.CertAccountCreate)) *CertAccountRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.CertAccountCreate)) + run(args[0].(context.Context), args[1].(*request.CertAccountCreate)) }) return _c } @@ -75,22 +79,22 @@ func (_c *CertAccountRepo_Create_Call) Return(_a0 *biz.CertAccount, _a1 error) * return _c } -func (_c *CertAccountRepo_Create_Call) RunAndReturn(run func(*request.CertAccountCreate) (*biz.CertAccount, error)) *CertAccountRepo_Create_Call { +func (_c *CertAccountRepo_Create_Call) RunAndReturn(run func(context.Context, *request.CertAccountCreate) (*biz.CertAccount, error)) *CertAccountRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: id -func (_m *CertAccountRepo) Delete(id uint) error { - ret := _m.Called(id) +// Delete provides a mock function with given fields: ctx, id +func (_m *CertAccountRepo) Delete(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint) error); ok { - r0 = rf(id) + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) } else { r0 = ret.Error(0) } @@ -104,14 +108,15 @@ type CertAccountRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - id uint -func (_e *CertAccountRepo_Expecter) Delete(id interface{}) *CertAccountRepo_Delete_Call { - return &CertAccountRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +func (_e *CertAccountRepo_Expecter) Delete(ctx interface{}, id interface{}) *CertAccountRepo_Delete_Call { + return &CertAccountRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, id)} } -func (_c *CertAccountRepo_Delete_Call) Run(run func(id uint)) *CertAccountRepo_Delete_Call { +func (_c *CertAccountRepo_Delete_Call) Run(run func(ctx context.Context, id uint)) *CertAccountRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint)) + run(args[0].(context.Context), args[1].(uint)) }) return _c } @@ -121,7 +126,7 @@ func (_c *CertAccountRepo_Delete_Call) Return(_a0 error) *CertAccountRepo_Delete return _c } -func (_c *CertAccountRepo_Delete_Call) RunAndReturn(run func(uint) error) *CertAccountRepo_Delete_Call { +func (_c *CertAccountRepo_Delete_Call) RunAndReturn(run func(context.Context, uint) error) *CertAccountRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -308,17 +313,17 @@ func (_c *CertAccountRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.C return _c } -// Update provides a mock function with given fields: req -func (_m *CertAccountRepo) Update(req *request.CertAccountUpdate) error { - ret := _m.Called(req) +// Update provides a mock function with given fields: ctx, req +func (_m *CertAccountRepo) Update(ctx context.Context, req *request.CertAccountUpdate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if rf, ok := ret.Get(0).(func(*request.CertAccountUpdate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertAccountUpdate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -332,14 +337,15 @@ type CertAccountRepo_Update_Call struct { } // Update is a helper method to define mock.On call +// - ctx context.Context // - req *request.CertAccountUpdate -func (_e *CertAccountRepo_Expecter) Update(req interface{}) *CertAccountRepo_Update_Call { - return &CertAccountRepo_Update_Call{Call: _e.mock.On("Update", req)} +func (_e *CertAccountRepo_Expecter) Update(ctx interface{}, req interface{}) *CertAccountRepo_Update_Call { + return &CertAccountRepo_Update_Call{Call: _e.mock.On("Update", ctx, req)} } -func (_c *CertAccountRepo_Update_Call) Run(run func(req *request.CertAccountUpdate)) *CertAccountRepo_Update_Call { +func (_c *CertAccountRepo_Update_Call) Run(run func(ctx context.Context, req *request.CertAccountUpdate)) *CertAccountRepo_Update_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.CertAccountUpdate)) + run(args[0].(context.Context), args[1].(*request.CertAccountUpdate)) }) return _c } @@ -349,7 +355,7 @@ func (_c *CertAccountRepo_Update_Call) Return(_a0 error) *CertAccountRepo_Update return _c } -func (_c *CertAccountRepo_Update_Call) RunAndReturn(run func(*request.CertAccountUpdate) error) *CertAccountRepo_Update_Call { +func (_c *CertAccountRepo_Update_Call) RunAndReturn(run func(context.Context, *request.CertAccountUpdate) error) *CertAccountRepo_Update_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/CertDNSRepo.go b/mocks/biz/CertDNSRepo.go index 1ec09e2f..6eb755bd 100644 --- a/mocks/biz/CertDNSRepo.go +++ b/mocks/biz/CertDNSRepo.go @@ -3,7 +3,10 @@ package biz import ( + context "context" + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" request "github.com/acepanel/panel/internal/http/request" @@ -22,9 +25,9 @@ func (_m *CertDNSRepo) EXPECT() *CertDNSRepo_Expecter { return &CertDNSRepo_Expecter{mock: &_m.Mock} } -// Create provides a mock function with given fields: req -func (_m *CertDNSRepo) Create(req *request.CertDNSCreate) (*biz.CertDNS, error) { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *CertDNSRepo) Create(ctx context.Context, req *request.CertDNSCreate) (*biz.CertDNS, error) { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") @@ -32,19 +35,19 @@ func (_m *CertDNSRepo) Create(req *request.CertDNSCreate) (*biz.CertDNS, error) var r0 *biz.CertDNS var r1 error - if rf, ok := ret.Get(0).(func(*request.CertDNSCreate) (*biz.CertDNS, error)); ok { - return rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertDNSCreate) (*biz.CertDNS, error)); ok { + return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(*request.CertDNSCreate) *biz.CertDNS); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertDNSCreate) *biz.CertDNS); ok { + r0 = rf(ctx, req) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*biz.CertDNS) } } - if rf, ok := ret.Get(1).(func(*request.CertDNSCreate) error); ok { - r1 = rf(req) + if rf, ok := ret.Get(1).(func(context.Context, *request.CertDNSCreate) error); ok { + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -58,14 +61,15 @@ type CertDNSRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.CertDNSCreate -func (_e *CertDNSRepo_Expecter) Create(req interface{}) *CertDNSRepo_Create_Call { - return &CertDNSRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *CertDNSRepo_Expecter) Create(ctx interface{}, req interface{}) *CertDNSRepo_Create_Call { + return &CertDNSRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *CertDNSRepo_Create_Call) Run(run func(req *request.CertDNSCreate)) *CertDNSRepo_Create_Call { +func (_c *CertDNSRepo_Create_Call) Run(run func(ctx context.Context, req *request.CertDNSCreate)) *CertDNSRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.CertDNSCreate)) + run(args[0].(context.Context), args[1].(*request.CertDNSCreate)) }) return _c } @@ -75,22 +79,22 @@ func (_c *CertDNSRepo_Create_Call) Return(_a0 *biz.CertDNS, _a1 error) *CertDNSR return _c } -func (_c *CertDNSRepo_Create_Call) RunAndReturn(run func(*request.CertDNSCreate) (*biz.CertDNS, error)) *CertDNSRepo_Create_Call { +func (_c *CertDNSRepo_Create_Call) RunAndReturn(run func(context.Context, *request.CertDNSCreate) (*biz.CertDNS, error)) *CertDNSRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: id -func (_m *CertDNSRepo) Delete(id uint) error { - ret := _m.Called(id) +// Delete provides a mock function with given fields: ctx, id +func (_m *CertDNSRepo) Delete(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint) error); ok { - r0 = rf(id) + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) } else { r0 = ret.Error(0) } @@ -104,14 +108,15 @@ type CertDNSRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - id uint -func (_e *CertDNSRepo_Expecter) Delete(id interface{}) *CertDNSRepo_Delete_Call { - return &CertDNSRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +func (_e *CertDNSRepo_Expecter) Delete(ctx interface{}, id interface{}) *CertDNSRepo_Delete_Call { + return &CertDNSRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, id)} } -func (_c *CertDNSRepo_Delete_Call) Run(run func(id uint)) *CertDNSRepo_Delete_Call { +func (_c *CertDNSRepo_Delete_Call) Run(run func(ctx context.Context, id uint)) *CertDNSRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint)) + run(args[0].(context.Context), args[1].(uint)) }) return _c } @@ -121,7 +126,7 @@ func (_c *CertDNSRepo_Delete_Call) Return(_a0 error) *CertDNSRepo_Delete_Call { return _c } -func (_c *CertDNSRepo_Delete_Call) RunAndReturn(run func(uint) error) *CertDNSRepo_Delete_Call { +func (_c *CertDNSRepo_Delete_Call) RunAndReturn(run func(context.Context, uint) error) *CertDNSRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -250,17 +255,17 @@ func (_c *CertDNSRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.CertD return _c } -// Update provides a mock function with given fields: req -func (_m *CertDNSRepo) Update(req *request.CertDNSUpdate) error { - ret := _m.Called(req) +// Update provides a mock function with given fields: ctx, req +func (_m *CertDNSRepo) Update(ctx context.Context, req *request.CertDNSUpdate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if rf, ok := ret.Get(0).(func(*request.CertDNSUpdate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertDNSUpdate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -274,14 +279,15 @@ type CertDNSRepo_Update_Call struct { } // Update is a helper method to define mock.On call +// - ctx context.Context // - req *request.CertDNSUpdate -func (_e *CertDNSRepo_Expecter) Update(req interface{}) *CertDNSRepo_Update_Call { - return &CertDNSRepo_Update_Call{Call: _e.mock.On("Update", req)} +func (_e *CertDNSRepo_Expecter) Update(ctx interface{}, req interface{}) *CertDNSRepo_Update_Call { + return &CertDNSRepo_Update_Call{Call: _e.mock.On("Update", ctx, req)} } -func (_c *CertDNSRepo_Update_Call) Run(run func(req *request.CertDNSUpdate)) *CertDNSRepo_Update_Call { +func (_c *CertDNSRepo_Update_Call) Run(run func(ctx context.Context, req *request.CertDNSUpdate)) *CertDNSRepo_Update_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.CertDNSUpdate)) + run(args[0].(context.Context), args[1].(*request.CertDNSUpdate)) }) return _c } @@ -291,7 +297,7 @@ func (_c *CertDNSRepo_Update_Call) Return(_a0 error) *CertDNSRepo_Update_Call { return _c } -func (_c *CertDNSRepo_Update_Call) RunAndReturn(run func(*request.CertDNSUpdate) error) *CertDNSRepo_Update_Call { +func (_c *CertDNSRepo_Update_Call) RunAndReturn(run func(context.Context, *request.CertDNSUpdate) error) *CertDNSRepo_Update_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/CertRepo.go b/mocks/biz/CertRepo.go index 74119c43..5d60dbec 100644 --- a/mocks/biz/CertRepo.go +++ b/mocks/biz/CertRepo.go @@ -6,6 +6,8 @@ import ( biz "github.com/acepanel/panel/internal/biz" acme "github.com/acepanel/panel/pkg/acme" + context "context" + mock "github.com/stretchr/testify/mock" request "github.com/acepanel/panel/internal/http/request" @@ -28,9 +30,9 @@ func (_m *CertRepo) EXPECT() *CertRepo_Expecter { return &CertRepo_Expecter{mock: &_m.Mock} } -// Create provides a mock function with given fields: req -func (_m *CertRepo) Create(req *request.CertCreate) (*biz.Cert, error) { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *CertRepo) Create(ctx context.Context, req *request.CertCreate) (*biz.Cert, error) { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") @@ -38,19 +40,19 @@ func (_m *CertRepo) Create(req *request.CertCreate) (*biz.Cert, error) { var r0 *biz.Cert var r1 error - if rf, ok := ret.Get(0).(func(*request.CertCreate) (*biz.Cert, error)); ok { - return rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertCreate) (*biz.Cert, error)); ok { + return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(*request.CertCreate) *biz.Cert); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertCreate) *biz.Cert); ok { + r0 = rf(ctx, req) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*biz.Cert) } } - if rf, ok := ret.Get(1).(func(*request.CertCreate) error); ok { - r1 = rf(req) + if rf, ok := ret.Get(1).(func(context.Context, *request.CertCreate) error); ok { + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -64,14 +66,15 @@ type CertRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.CertCreate -func (_e *CertRepo_Expecter) Create(req interface{}) *CertRepo_Create_Call { - return &CertRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *CertRepo_Expecter) Create(ctx interface{}, req interface{}) *CertRepo_Create_Call { + return &CertRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *CertRepo_Create_Call) Run(run func(req *request.CertCreate)) *CertRepo_Create_Call { +func (_c *CertRepo_Create_Call) Run(run func(ctx context.Context, req *request.CertCreate)) *CertRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.CertCreate)) + run(args[0].(context.Context), args[1].(*request.CertCreate)) }) return _c } @@ -81,22 +84,22 @@ func (_c *CertRepo_Create_Call) Return(_a0 *biz.Cert, _a1 error) *CertRepo_Creat return _c } -func (_c *CertRepo_Create_Call) RunAndReturn(run func(*request.CertCreate) (*biz.Cert, error)) *CertRepo_Create_Call { +func (_c *CertRepo_Create_Call) RunAndReturn(run func(context.Context, *request.CertCreate) (*biz.Cert, error)) *CertRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: id -func (_m *CertRepo) Delete(id uint) error { - ret := _m.Called(id) +// Delete provides a mock function with given fields: ctx, id +func (_m *CertRepo) Delete(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint) error); ok { - r0 = rf(id) + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) } else { r0 = ret.Error(0) } @@ -110,14 +113,15 @@ type CertRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - id uint -func (_e *CertRepo_Expecter) Delete(id interface{}) *CertRepo_Delete_Call { - return &CertRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +func (_e *CertRepo_Expecter) Delete(ctx interface{}, id interface{}) *CertRepo_Delete_Call { + return &CertRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, id)} } -func (_c *CertRepo_Delete_Call) Run(run func(id uint)) *CertRepo_Delete_Call { +func (_c *CertRepo_Delete_Call) Run(run func(ctx context.Context, id uint)) *CertRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint)) + run(args[0].(context.Context), args[1].(uint)) }) return _c } @@ -127,7 +131,7 @@ func (_c *CertRepo_Delete_Call) Return(_a0 error) *CertRepo_Delete_Call { return _c } -func (_c *CertRepo_Delete_Call) RunAndReturn(run func(uint) error) *CertRepo_Delete_Call { +func (_c *CertRepo_Delete_Call) RunAndReturn(run func(context.Context, uint) error) *CertRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -763,17 +767,17 @@ func (_c *CertRepo_Renew_Call) RunAndReturn(run func(uint) (*acme.Certificate, e return _c } -// Update provides a mock function with given fields: req -func (_m *CertRepo) Update(req *request.CertUpdate) error { - ret := _m.Called(req) +// Update provides a mock function with given fields: ctx, req +func (_m *CertRepo) Update(ctx context.Context, req *request.CertUpdate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if rf, ok := ret.Get(0).(func(*request.CertUpdate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertUpdate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -787,14 +791,15 @@ type CertRepo_Update_Call struct { } // Update is a helper method to define mock.On call +// - ctx context.Context // - req *request.CertUpdate -func (_e *CertRepo_Expecter) Update(req interface{}) *CertRepo_Update_Call { - return &CertRepo_Update_Call{Call: _e.mock.On("Update", req)} +func (_e *CertRepo_Expecter) Update(ctx interface{}, req interface{}) *CertRepo_Update_Call { + return &CertRepo_Update_Call{Call: _e.mock.On("Update", ctx, req)} } -func (_c *CertRepo_Update_Call) Run(run func(req *request.CertUpdate)) *CertRepo_Update_Call { +func (_c *CertRepo_Update_Call) Run(run func(ctx context.Context, req *request.CertUpdate)) *CertRepo_Update_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.CertUpdate)) + run(args[0].(context.Context), args[1].(*request.CertUpdate)) }) return _c } @@ -804,14 +809,14 @@ func (_c *CertRepo_Update_Call) Return(_a0 error) *CertRepo_Update_Call { return _c } -func (_c *CertRepo_Update_Call) RunAndReturn(run func(*request.CertUpdate) error) *CertRepo_Update_Call { +func (_c *CertRepo_Update_Call) RunAndReturn(run func(context.Context, *request.CertUpdate) error) *CertRepo_Update_Call { _c.Call.Return(run) return _c } -// Upload provides a mock function with given fields: req -func (_m *CertRepo) Upload(req *request.CertUpload) (*biz.Cert, error) { - ret := _m.Called(req) +// Upload provides a mock function with given fields: ctx, req +func (_m *CertRepo) Upload(ctx context.Context, req *request.CertUpload) (*biz.Cert, error) { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Upload") @@ -819,19 +824,19 @@ func (_m *CertRepo) Upload(req *request.CertUpload) (*biz.Cert, error) { var r0 *biz.Cert var r1 error - if rf, ok := ret.Get(0).(func(*request.CertUpload) (*biz.Cert, error)); ok { - return rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertUpload) (*biz.Cert, error)); ok { + return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(*request.CertUpload) *biz.Cert); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CertUpload) *biz.Cert); ok { + r0 = rf(ctx, req) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*biz.Cert) } } - if rf, ok := ret.Get(1).(func(*request.CertUpload) error); ok { - r1 = rf(req) + if rf, ok := ret.Get(1).(func(context.Context, *request.CertUpload) error); ok { + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -845,14 +850,15 @@ type CertRepo_Upload_Call struct { } // Upload is a helper method to define mock.On call +// - ctx context.Context // - req *request.CertUpload -func (_e *CertRepo_Expecter) Upload(req interface{}) *CertRepo_Upload_Call { - return &CertRepo_Upload_Call{Call: _e.mock.On("Upload", req)} +func (_e *CertRepo_Expecter) Upload(ctx interface{}, req interface{}) *CertRepo_Upload_Call { + return &CertRepo_Upload_Call{Call: _e.mock.On("Upload", ctx, req)} } -func (_c *CertRepo_Upload_Call) Run(run func(req *request.CertUpload)) *CertRepo_Upload_Call { +func (_c *CertRepo_Upload_Call) Run(run func(ctx context.Context, req *request.CertUpload)) *CertRepo_Upload_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.CertUpload)) + run(args[0].(context.Context), args[1].(*request.CertUpload)) }) return _c } @@ -862,7 +868,7 @@ func (_c *CertRepo_Upload_Call) Return(_a0 *biz.Cert, _a1 error) *CertRepo_Uploa return _c } -func (_c *CertRepo_Upload_Call) RunAndReturn(run func(*request.CertUpload) (*biz.Cert, error)) *CertRepo_Upload_Call { +func (_c *CertRepo_Upload_Call) RunAndReturn(run func(context.Context, *request.CertUpload) (*biz.Cert, error)) *CertRepo_Upload_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/CronRepo.go b/mocks/biz/CronRepo.go index 659e2da5..115ff18c 100644 --- a/mocks/biz/CronRepo.go +++ b/mocks/biz/CronRepo.go @@ -3,7 +3,10 @@ package biz import ( + context "context" + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" request "github.com/acepanel/panel/internal/http/request" @@ -77,17 +80,17 @@ func (_c *CronRepo_Count_Call) RunAndReturn(run func() (int64, error)) *CronRepo return _c } -// Create provides a mock function with given fields: req -func (_m *CronRepo) Create(req *request.CronCreate) error { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *CronRepo) Create(ctx context.Context, req *request.CronCreate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") } var r0 error - if rf, ok := ret.Get(0).(func(*request.CronCreate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CronCreate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -101,14 +104,15 @@ type CronRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.CronCreate -func (_e *CronRepo_Expecter) Create(req interface{}) *CronRepo_Create_Call { - return &CronRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *CronRepo_Expecter) Create(ctx interface{}, req interface{}) *CronRepo_Create_Call { + return &CronRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *CronRepo_Create_Call) Run(run func(req *request.CronCreate)) *CronRepo_Create_Call { +func (_c *CronRepo_Create_Call) Run(run func(ctx context.Context, req *request.CronCreate)) *CronRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.CronCreate)) + run(args[0].(context.Context), args[1].(*request.CronCreate)) }) return _c } @@ -118,22 +122,22 @@ func (_c *CronRepo_Create_Call) Return(_a0 error) *CronRepo_Create_Call { return _c } -func (_c *CronRepo_Create_Call) RunAndReturn(run func(*request.CronCreate) error) *CronRepo_Create_Call { +func (_c *CronRepo_Create_Call) RunAndReturn(run func(context.Context, *request.CronCreate) error) *CronRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: id -func (_m *CronRepo) Delete(id uint) error { - ret := _m.Called(id) +// Delete provides a mock function with given fields: ctx, id +func (_m *CronRepo) Delete(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint) error); ok { - r0 = rf(id) + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) } else { r0 = ret.Error(0) } @@ -147,14 +151,15 @@ type CronRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - id uint -func (_e *CronRepo_Expecter) Delete(id interface{}) *CronRepo_Delete_Call { - return &CronRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +func (_e *CronRepo_Expecter) Delete(ctx interface{}, id interface{}) *CronRepo_Delete_Call { + return &CronRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, id)} } -func (_c *CronRepo_Delete_Call) Run(run func(id uint)) *CronRepo_Delete_Call { +func (_c *CronRepo_Delete_Call) Run(run func(ctx context.Context, id uint)) *CronRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint)) + run(args[0].(context.Context), args[1].(uint)) }) return _c } @@ -164,7 +169,7 @@ func (_c *CronRepo_Delete_Call) Return(_a0 error) *CronRepo_Delete_Call { return _c } -func (_c *CronRepo_Delete_Call) RunAndReturn(run func(uint) error) *CronRepo_Delete_Call { +func (_c *CronRepo_Delete_Call) RunAndReturn(run func(context.Context, uint) error) *CronRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -340,17 +345,17 @@ func (_c *CronRepo_Status_Call) RunAndReturn(run func(uint, bool) error) *CronRe return _c } -// Update provides a mock function with given fields: req -func (_m *CronRepo) Update(req *request.CronUpdate) error { - ret := _m.Called(req) +// Update provides a mock function with given fields: ctx, req +func (_m *CronRepo) Update(ctx context.Context, req *request.CronUpdate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if rf, ok := ret.Get(0).(func(*request.CronUpdate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.CronUpdate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -364,14 +369,15 @@ type CronRepo_Update_Call struct { } // Update is a helper method to define mock.On call +// - ctx context.Context // - req *request.CronUpdate -func (_e *CronRepo_Expecter) Update(req interface{}) *CronRepo_Update_Call { - return &CronRepo_Update_Call{Call: _e.mock.On("Update", req)} +func (_e *CronRepo_Expecter) Update(ctx interface{}, req interface{}) *CronRepo_Update_Call { + return &CronRepo_Update_Call{Call: _e.mock.On("Update", ctx, req)} } -func (_c *CronRepo_Update_Call) Run(run func(req *request.CronUpdate)) *CronRepo_Update_Call { +func (_c *CronRepo_Update_Call) Run(run func(ctx context.Context, req *request.CronUpdate)) *CronRepo_Update_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.CronUpdate)) + run(args[0].(context.Context), args[1].(*request.CronUpdate)) }) return _c } @@ -381,7 +387,7 @@ func (_c *CronRepo_Update_Call) Return(_a0 error) *CronRepo_Update_Call { return _c } -func (_c *CronRepo_Update_Call) RunAndReturn(run func(*request.CronUpdate) error) *CronRepo_Update_Call { +func (_c *CronRepo_Update_Call) RunAndReturn(run func(context.Context, *request.CronUpdate) error) *CronRepo_Update_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/DatabaseRepo.go b/mocks/biz/DatabaseRepo.go index 7a2bdbaa..7aa918e5 100644 --- a/mocks/biz/DatabaseRepo.go +++ b/mocks/biz/DatabaseRepo.go @@ -3,7 +3,10 @@ package biz import ( + context "context" + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" request "github.com/acepanel/panel/internal/http/request" @@ -68,17 +71,17 @@ func (_c *DatabaseRepo_Comment_Call) RunAndReturn(run func(*request.DatabaseComm return _c } -// Create provides a mock function with given fields: req -func (_m *DatabaseRepo) Create(req *request.DatabaseCreate) error { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *DatabaseRepo) Create(ctx context.Context, req *request.DatabaseCreate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") } var r0 error - if rf, ok := ret.Get(0).(func(*request.DatabaseCreate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.DatabaseCreate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -92,14 +95,15 @@ type DatabaseRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.DatabaseCreate -func (_e *DatabaseRepo_Expecter) Create(req interface{}) *DatabaseRepo_Create_Call { - return &DatabaseRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *DatabaseRepo_Expecter) Create(ctx interface{}, req interface{}) *DatabaseRepo_Create_Call { + return &DatabaseRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *DatabaseRepo_Create_Call) Run(run func(req *request.DatabaseCreate)) *DatabaseRepo_Create_Call { +func (_c *DatabaseRepo_Create_Call) Run(run func(ctx context.Context, req *request.DatabaseCreate)) *DatabaseRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.DatabaseCreate)) + run(args[0].(context.Context), args[1].(*request.DatabaseCreate)) }) return _c } @@ -109,22 +113,22 @@ func (_c *DatabaseRepo_Create_Call) Return(_a0 error) *DatabaseRepo_Create_Call return _c } -func (_c *DatabaseRepo_Create_Call) RunAndReturn(run func(*request.DatabaseCreate) error) *DatabaseRepo_Create_Call { +func (_c *DatabaseRepo_Create_Call) RunAndReturn(run func(context.Context, *request.DatabaseCreate) error) *DatabaseRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: serverID, name -func (_m *DatabaseRepo) Delete(serverID uint, name string) error { - ret := _m.Called(serverID, name) +// Delete provides a mock function with given fields: ctx, serverID, name +func (_m *DatabaseRepo) Delete(ctx context.Context, serverID uint, name string) error { + ret := _m.Called(ctx, serverID, name) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint, string) error); ok { - r0 = rf(serverID, name) + if rf, ok := ret.Get(0).(func(context.Context, uint, string) error); ok { + r0 = rf(ctx, serverID, name) } else { r0 = ret.Error(0) } @@ -138,15 +142,16 @@ type DatabaseRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - serverID uint // - name string -func (_e *DatabaseRepo_Expecter) Delete(serverID interface{}, name interface{}) *DatabaseRepo_Delete_Call { - return &DatabaseRepo_Delete_Call{Call: _e.mock.On("Delete", serverID, name)} +func (_e *DatabaseRepo_Expecter) Delete(ctx interface{}, serverID interface{}, name interface{}) *DatabaseRepo_Delete_Call { + return &DatabaseRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, serverID, name)} } -func (_c *DatabaseRepo_Delete_Call) Run(run func(serverID uint, name string)) *DatabaseRepo_Delete_Call { +func (_c *DatabaseRepo_Delete_Call) Run(run func(ctx context.Context, serverID uint, name string)) *DatabaseRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint), args[1].(string)) + run(args[0].(context.Context), args[1].(uint), args[2].(string)) }) return _c } @@ -156,7 +161,7 @@ func (_c *DatabaseRepo_Delete_Call) Return(_a0 error) *DatabaseRepo_Delete_Call return _c } -func (_c *DatabaseRepo_Delete_Call) RunAndReturn(run func(uint, string) error) *DatabaseRepo_Delete_Call { +func (_c *DatabaseRepo_Delete_Call) RunAndReturn(run func(context.Context, uint, string) error) *DatabaseRepo_Delete_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/DatabaseUserRepo.go b/mocks/biz/DatabaseUserRepo.go index 529c9a91..ed6f97dd 100644 --- a/mocks/biz/DatabaseUserRepo.go +++ b/mocks/biz/DatabaseUserRepo.go @@ -3,7 +3,10 @@ package biz import ( + context "context" + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" request "github.com/acepanel/panel/internal/http/request" @@ -77,17 +80,17 @@ func (_c *DatabaseUserRepo_Count_Call) RunAndReturn(run func() (int64, error)) * return _c } -// Create provides a mock function with given fields: req -func (_m *DatabaseUserRepo) Create(req *request.DatabaseUserCreate) error { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *DatabaseUserRepo) Create(ctx context.Context, req *request.DatabaseUserCreate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") } var r0 error - if rf, ok := ret.Get(0).(func(*request.DatabaseUserCreate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.DatabaseUserCreate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -101,14 +104,15 @@ type DatabaseUserRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.DatabaseUserCreate -func (_e *DatabaseUserRepo_Expecter) Create(req interface{}) *DatabaseUserRepo_Create_Call { - return &DatabaseUserRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *DatabaseUserRepo_Expecter) Create(ctx interface{}, req interface{}) *DatabaseUserRepo_Create_Call { + return &DatabaseUserRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *DatabaseUserRepo_Create_Call) Run(run func(req *request.DatabaseUserCreate)) *DatabaseUserRepo_Create_Call { +func (_c *DatabaseUserRepo_Create_Call) Run(run func(ctx context.Context, req *request.DatabaseUserCreate)) *DatabaseUserRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.DatabaseUserCreate)) + run(args[0].(context.Context), args[1].(*request.DatabaseUserCreate)) }) return _c } @@ -118,22 +122,22 @@ func (_c *DatabaseUserRepo_Create_Call) Return(_a0 error) *DatabaseUserRepo_Crea return _c } -func (_c *DatabaseUserRepo_Create_Call) RunAndReturn(run func(*request.DatabaseUserCreate) error) *DatabaseUserRepo_Create_Call { +func (_c *DatabaseUserRepo_Create_Call) RunAndReturn(run func(context.Context, *request.DatabaseUserCreate) error) *DatabaseUserRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: id -func (_m *DatabaseUserRepo) Delete(id uint) error { - ret := _m.Called(id) +// Delete provides a mock function with given fields: ctx, id +func (_m *DatabaseUserRepo) Delete(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint) error); ok { - r0 = rf(id) + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) } else { r0 = ret.Error(0) } @@ -147,14 +151,15 @@ type DatabaseUserRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - id uint -func (_e *DatabaseUserRepo_Expecter) Delete(id interface{}) *DatabaseUserRepo_Delete_Call { - return &DatabaseUserRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +func (_e *DatabaseUserRepo_Expecter) Delete(ctx interface{}, id interface{}) *DatabaseUserRepo_Delete_Call { + return &DatabaseUserRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, id)} } -func (_c *DatabaseUserRepo_Delete_Call) Run(run func(id uint)) *DatabaseUserRepo_Delete_Call { +func (_c *DatabaseUserRepo_Delete_Call) Run(run func(ctx context.Context, id uint)) *DatabaseUserRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint)) + run(args[0].(context.Context), args[1].(uint)) }) return _c } @@ -164,7 +169,7 @@ func (_c *DatabaseUserRepo_Delete_Call) Return(_a0 error) *DatabaseUserRepo_Dele return _c } -func (_c *DatabaseUserRepo_Delete_Call) RunAndReturn(run func(uint) error) *DatabaseUserRepo_Delete_Call { +func (_c *DatabaseUserRepo_Delete_Call) RunAndReturn(run func(context.Context, uint) error) *DatabaseUserRepo_Delete_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/LogRepo.go b/mocks/biz/LogRepo.go new file mode 100644 index 00000000..1666e45b --- /dev/null +++ b/mocks/biz/LogRepo.go @@ -0,0 +1,94 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" +) + +// LogRepo is an autogenerated mock type for the LogRepo type +type LogRepo struct { + mock.Mock +} + +type LogRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *LogRepo) EXPECT() *LogRepo_Expecter { + return &LogRepo_Expecter{mock: &_m.Mock} +} + +// List provides a mock function with given fields: logType, limit +func (_m *LogRepo) List(logType string, limit int) ([]biz.LogEntry, error) { + ret := _m.Called(logType, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []biz.LogEntry + var r1 error + if rf, ok := ret.Get(0).(func(string, int) ([]biz.LogEntry, error)); ok { + return rf(logType, limit) + } + if rf, ok := ret.Get(0).(func(string, int) []biz.LogEntry); ok { + r0 = rf(logType, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]biz.LogEntry) + } + } + + if rf, ok := ret.Get(1).(func(string, int) error); ok { + r1 = rf(logType, limit) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// LogRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type LogRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - logType string +// - limit int +func (_e *LogRepo_Expecter) List(logType interface{}, limit interface{}) *LogRepo_List_Call { + return &LogRepo_List_Call{Call: _e.mock.On("List", logType, limit)} +} + +func (_c *LogRepo_List_Call) Run(run func(logType string, limit int)) *LogRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(int)) + }) + return _c +} + +func (_c *LogRepo_List_Call) Return(_a0 []biz.LogEntry, _a1 error) *LogRepo_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *LogRepo_List_Call) RunAndReturn(run func(string, int) ([]biz.LogEntry, error)) *LogRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// NewLogRepo creates a new instance of LogRepo. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewLogRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *LogRepo { + mock := &LogRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/ProjectRepo.go b/mocks/biz/ProjectRepo.go index 2810e95e..5d483303 100644 --- a/mocks/biz/ProjectRepo.go +++ b/mocks/biz/ProjectRepo.go @@ -3,9 +3,12 @@ package biz import ( + context "context" + request "github.com/acepanel/panel/internal/http/request" - types "github.com/acepanel/panel/pkg/types" mock "github.com/stretchr/testify/mock" + + types "github.com/acepanel/panel/pkg/types" ) // ProjectRepo is an autogenerated mock type for the ProjectRepo type @@ -21,9 +24,9 @@ func (_m *ProjectRepo) EXPECT() *ProjectRepo_Expecter { return &ProjectRepo_Expecter{mock: &_m.Mock} } -// Create provides a mock function with given fields: req -func (_m *ProjectRepo) Create(req *request.ProjectCreate) (*types.ProjectDetail, error) { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *ProjectRepo) Create(ctx context.Context, req *request.ProjectCreate) (*types.ProjectDetail, error) { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") @@ -31,19 +34,19 @@ func (_m *ProjectRepo) Create(req *request.ProjectCreate) (*types.ProjectDetail, var r0 *types.ProjectDetail var r1 error - if rf, ok := ret.Get(0).(func(*request.ProjectCreate) (*types.ProjectDetail, error)); ok { - return rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.ProjectCreate) (*types.ProjectDetail, error)); ok { + return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(*request.ProjectCreate) *types.ProjectDetail); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.ProjectCreate) *types.ProjectDetail); ok { + r0 = rf(ctx, req) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*types.ProjectDetail) } } - if rf, ok := ret.Get(1).(func(*request.ProjectCreate) error); ok { - r1 = rf(req) + if rf, ok := ret.Get(1).(func(context.Context, *request.ProjectCreate) error); ok { + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -57,14 +60,15 @@ type ProjectRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.ProjectCreate -func (_e *ProjectRepo_Expecter) Create(req interface{}) *ProjectRepo_Create_Call { - return &ProjectRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *ProjectRepo_Expecter) Create(ctx interface{}, req interface{}) *ProjectRepo_Create_Call { + return &ProjectRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *ProjectRepo_Create_Call) Run(run func(req *request.ProjectCreate)) *ProjectRepo_Create_Call { +func (_c *ProjectRepo_Create_Call) Run(run func(ctx context.Context, req *request.ProjectCreate)) *ProjectRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.ProjectCreate)) + run(args[0].(context.Context), args[1].(*request.ProjectCreate)) }) return _c } @@ -74,22 +78,22 @@ func (_c *ProjectRepo_Create_Call) Return(_a0 *types.ProjectDetail, _a1 error) * return _c } -func (_c *ProjectRepo_Create_Call) RunAndReturn(run func(*request.ProjectCreate) (*types.ProjectDetail, error)) *ProjectRepo_Create_Call { +func (_c *ProjectRepo_Create_Call) RunAndReturn(run func(context.Context, *request.ProjectCreate) (*types.ProjectDetail, error)) *ProjectRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: id -func (_m *ProjectRepo) Delete(id uint) error { - ret := _m.Called(id) +// Delete provides a mock function with given fields: ctx, id +func (_m *ProjectRepo) Delete(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint) error); ok { - r0 = rf(id) + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) } else { r0 = ret.Error(0) } @@ -103,14 +107,15 @@ type ProjectRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - id uint -func (_e *ProjectRepo_Expecter) Delete(id interface{}) *ProjectRepo_Delete_Call { - return &ProjectRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +func (_e *ProjectRepo_Expecter) Delete(ctx interface{}, id interface{}) *ProjectRepo_Delete_Call { + return &ProjectRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, id)} } -func (_c *ProjectRepo_Delete_Call) Run(run func(id uint)) *ProjectRepo_Delete_Call { +func (_c *ProjectRepo_Delete_Call) Run(run func(ctx context.Context, id uint)) *ProjectRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint)) + run(args[0].(context.Context), args[1].(uint)) }) return _c } @@ -120,7 +125,7 @@ func (_c *ProjectRepo_Delete_Call) Return(_a0 error) *ProjectRepo_Delete_Call { return _c } -func (_c *ProjectRepo_Delete_Call) RunAndReturn(run func(uint) error) *ProjectRepo_Delete_Call { +func (_c *ProjectRepo_Delete_Call) RunAndReturn(run func(context.Context, uint) error) *ProjectRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -250,17 +255,17 @@ func (_c *ProjectRepo_List_Call) RunAndReturn(run func(types.ProjectType, uint, return _c } -// Update provides a mock function with given fields: req -func (_m *ProjectRepo) Update(req *request.ProjectUpdate) error { - ret := _m.Called(req) +// Update provides a mock function with given fields: ctx, req +func (_m *ProjectRepo) Update(ctx context.Context, req *request.ProjectUpdate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if rf, ok := ret.Get(0).(func(*request.ProjectUpdate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.ProjectUpdate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -274,14 +279,15 @@ type ProjectRepo_Update_Call struct { } // Update is a helper method to define mock.On call +// - ctx context.Context // - req *request.ProjectUpdate -func (_e *ProjectRepo_Expecter) Update(req interface{}) *ProjectRepo_Update_Call { - return &ProjectRepo_Update_Call{Call: _e.mock.On("Update", req)} +func (_e *ProjectRepo_Expecter) Update(ctx interface{}, req interface{}) *ProjectRepo_Update_Call { + return &ProjectRepo_Update_Call{Call: _e.mock.On("Update", ctx, req)} } -func (_c *ProjectRepo_Update_Call) Run(run func(req *request.ProjectUpdate)) *ProjectRepo_Update_Call { +func (_c *ProjectRepo_Update_Call) Run(run func(ctx context.Context, req *request.ProjectUpdate)) *ProjectRepo_Update_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.ProjectUpdate)) + run(args[0].(context.Context), args[1].(*request.ProjectUpdate)) }) return _c } @@ -291,7 +297,7 @@ func (_c *ProjectRepo_Update_Call) Return(_a0 error) *ProjectRepo_Update_Call { return _c } -func (_c *ProjectRepo_Update_Call) RunAndReturn(run func(*request.ProjectUpdate) error) *ProjectRepo_Update_Call { +func (_c *ProjectRepo_Update_Call) RunAndReturn(run func(context.Context, *request.ProjectUpdate) error) *ProjectRepo_Update_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/SSHRepo.go b/mocks/biz/SSHRepo.go index f3cedbc4..dffa63e8 100644 --- a/mocks/biz/SSHRepo.go +++ b/mocks/biz/SSHRepo.go @@ -3,7 +3,10 @@ package biz import ( + context "context" + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" request "github.com/acepanel/panel/internal/http/request" @@ -22,17 +25,17 @@ func (_m *SSHRepo) EXPECT() *SSHRepo_Expecter { return &SSHRepo_Expecter{mock: &_m.Mock} } -// Create provides a mock function with given fields: req -func (_m *SSHRepo) Create(req *request.SSHCreate) error { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *SSHRepo) Create(ctx context.Context, req *request.SSHCreate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") } var r0 error - if rf, ok := ret.Get(0).(func(*request.SSHCreate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.SSHCreate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -46,14 +49,15 @@ type SSHRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.SSHCreate -func (_e *SSHRepo_Expecter) Create(req interface{}) *SSHRepo_Create_Call { - return &SSHRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *SSHRepo_Expecter) Create(ctx interface{}, req interface{}) *SSHRepo_Create_Call { + return &SSHRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *SSHRepo_Create_Call) Run(run func(req *request.SSHCreate)) *SSHRepo_Create_Call { +func (_c *SSHRepo_Create_Call) Run(run func(ctx context.Context, req *request.SSHCreate)) *SSHRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.SSHCreate)) + run(args[0].(context.Context), args[1].(*request.SSHCreate)) }) return _c } @@ -63,22 +67,22 @@ func (_c *SSHRepo_Create_Call) Return(_a0 error) *SSHRepo_Create_Call { return _c } -func (_c *SSHRepo_Create_Call) RunAndReturn(run func(*request.SSHCreate) error) *SSHRepo_Create_Call { +func (_c *SSHRepo_Create_Call) RunAndReturn(run func(context.Context, *request.SSHCreate) error) *SSHRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: id -func (_m *SSHRepo) Delete(id uint) error { - ret := _m.Called(id) +// Delete provides a mock function with given fields: ctx, id +func (_m *SSHRepo) Delete(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint) error); ok { - r0 = rf(id) + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) } else { r0 = ret.Error(0) } @@ -92,14 +96,15 @@ type SSHRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - id uint -func (_e *SSHRepo_Expecter) Delete(id interface{}) *SSHRepo_Delete_Call { - return &SSHRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +func (_e *SSHRepo_Expecter) Delete(ctx interface{}, id interface{}) *SSHRepo_Delete_Call { + return &SSHRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, id)} } -func (_c *SSHRepo_Delete_Call) Run(run func(id uint)) *SSHRepo_Delete_Call { +func (_c *SSHRepo_Delete_Call) Run(run func(ctx context.Context, id uint)) *SSHRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint)) + run(args[0].(context.Context), args[1].(uint)) }) return _c } @@ -109,7 +114,7 @@ func (_c *SSHRepo_Delete_Call) Return(_a0 error) *SSHRepo_Delete_Call { return _c } -func (_c *SSHRepo_Delete_Call) RunAndReturn(run func(uint) error) *SSHRepo_Delete_Call { +func (_c *SSHRepo_Delete_Call) RunAndReturn(run func(context.Context, uint) error) *SSHRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -238,17 +243,17 @@ func (_c *SSHRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.SSH, int6 return _c } -// Update provides a mock function with given fields: req -func (_m *SSHRepo) Update(req *request.SSHUpdate) error { - ret := _m.Called(req) +// Update provides a mock function with given fields: ctx, req +func (_m *SSHRepo) Update(ctx context.Context, req *request.SSHUpdate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if rf, ok := ret.Get(0).(func(*request.SSHUpdate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.SSHUpdate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -262,14 +267,15 @@ type SSHRepo_Update_Call struct { } // Update is a helper method to define mock.On call +// - ctx context.Context // - req *request.SSHUpdate -func (_e *SSHRepo_Expecter) Update(req interface{}) *SSHRepo_Update_Call { - return &SSHRepo_Update_Call{Call: _e.mock.On("Update", req)} +func (_e *SSHRepo_Expecter) Update(ctx interface{}, req interface{}) *SSHRepo_Update_Call { + return &SSHRepo_Update_Call{Call: _e.mock.On("Update", ctx, req)} } -func (_c *SSHRepo_Update_Call) Run(run func(req *request.SSHUpdate)) *SSHRepo_Update_Call { +func (_c *SSHRepo_Update_Call) Run(run func(ctx context.Context, req *request.SSHUpdate)) *SSHRepo_Update_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.SSHUpdate)) + run(args[0].(context.Context), args[1].(*request.SSHUpdate)) }) return _c } @@ -279,7 +285,7 @@ func (_c *SSHRepo_Update_Call) Return(_a0 error) *SSHRepo_Update_Call { return _c } -func (_c *SSHRepo_Update_Call) RunAndReturn(run func(*request.SSHUpdate) error) *SSHRepo_Update_Call { +func (_c *SSHRepo_Update_Call) RunAndReturn(run func(context.Context, *request.SSHUpdate) error) *SSHRepo_Update_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/SafeRepo.go b/mocks/biz/SafeRepo.go index 37dcf80c..adbea768 100644 --- a/mocks/biz/SafeRepo.go +++ b/mocks/biz/SafeRepo.go @@ -2,7 +2,11 @@ package biz -import mock "github.com/stretchr/testify/mock" +import ( + context "context" + + mock "github.com/stretchr/testify/mock" +) // SafeRepo is an autogenerated mock type for the SafeRepo type type SafeRepo struct { @@ -134,17 +138,17 @@ func (_c *SafeRepo_GetSSH_Call) RunAndReturn(run func() (uint, bool, error)) *Sa return _c } -// UpdatePingStatus provides a mock function with given fields: status -func (_m *SafeRepo) UpdatePingStatus(status bool) error { - ret := _m.Called(status) +// UpdatePingStatus provides a mock function with given fields: ctx, status +func (_m *SafeRepo) UpdatePingStatus(ctx context.Context, status bool) error { + ret := _m.Called(ctx, status) if len(ret) == 0 { panic("no return value specified for UpdatePingStatus") } var r0 error - if rf, ok := ret.Get(0).(func(bool) error); ok { - r0 = rf(status) + if rf, ok := ret.Get(0).(func(context.Context, bool) error); ok { + r0 = rf(ctx, status) } else { r0 = ret.Error(0) } @@ -158,14 +162,15 @@ type SafeRepo_UpdatePingStatus_Call struct { } // UpdatePingStatus is a helper method to define mock.On call +// - ctx context.Context // - status bool -func (_e *SafeRepo_Expecter) UpdatePingStatus(status interface{}) *SafeRepo_UpdatePingStatus_Call { - return &SafeRepo_UpdatePingStatus_Call{Call: _e.mock.On("UpdatePingStatus", status)} +func (_e *SafeRepo_Expecter) UpdatePingStatus(ctx interface{}, status interface{}) *SafeRepo_UpdatePingStatus_Call { + return &SafeRepo_UpdatePingStatus_Call{Call: _e.mock.On("UpdatePingStatus", ctx, status)} } -func (_c *SafeRepo_UpdatePingStatus_Call) Run(run func(status bool)) *SafeRepo_UpdatePingStatus_Call { +func (_c *SafeRepo_UpdatePingStatus_Call) Run(run func(ctx context.Context, status bool)) *SafeRepo_UpdatePingStatus_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(bool)) + run(args[0].(context.Context), args[1].(bool)) }) return _c } @@ -175,22 +180,22 @@ func (_c *SafeRepo_UpdatePingStatus_Call) Return(_a0 error) *SafeRepo_UpdatePing return _c } -func (_c *SafeRepo_UpdatePingStatus_Call) RunAndReturn(run func(bool) error) *SafeRepo_UpdatePingStatus_Call { +func (_c *SafeRepo_UpdatePingStatus_Call) RunAndReturn(run func(context.Context, bool) error) *SafeRepo_UpdatePingStatus_Call { _c.Call.Return(run) return _c } -// UpdateSSH provides a mock function with given fields: port, status -func (_m *SafeRepo) UpdateSSH(port uint, status bool) error { - ret := _m.Called(port, status) +// UpdateSSH provides a mock function with given fields: ctx, port, status +func (_m *SafeRepo) UpdateSSH(ctx context.Context, port uint, status bool) error { + ret := _m.Called(ctx, port, status) if len(ret) == 0 { panic("no return value specified for UpdateSSH") } var r0 error - if rf, ok := ret.Get(0).(func(uint, bool) error); ok { - r0 = rf(port, status) + if rf, ok := ret.Get(0).(func(context.Context, uint, bool) error); ok { + r0 = rf(ctx, port, status) } else { r0 = ret.Error(0) } @@ -204,15 +209,16 @@ type SafeRepo_UpdateSSH_Call struct { } // UpdateSSH is a helper method to define mock.On call +// - ctx context.Context // - port uint // - status bool -func (_e *SafeRepo_Expecter) UpdateSSH(port interface{}, status interface{}) *SafeRepo_UpdateSSH_Call { - return &SafeRepo_UpdateSSH_Call{Call: _e.mock.On("UpdateSSH", port, status)} +func (_e *SafeRepo_Expecter) UpdateSSH(ctx interface{}, port interface{}, status interface{}) *SafeRepo_UpdateSSH_Call { + return &SafeRepo_UpdateSSH_Call{Call: _e.mock.On("UpdateSSH", ctx, port, status)} } -func (_c *SafeRepo_UpdateSSH_Call) Run(run func(port uint, status bool)) *SafeRepo_UpdateSSH_Call { +func (_c *SafeRepo_UpdateSSH_Call) Run(run func(ctx context.Context, port uint, status bool)) *SafeRepo_UpdateSSH_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint), args[1].(bool)) + run(args[0].(context.Context), args[1].(uint), args[2].(bool)) }) return _c } @@ -222,7 +228,7 @@ func (_c *SafeRepo_UpdateSSH_Call) Return(_a0 error) *SafeRepo_UpdateSSH_Call { return _c } -func (_c *SafeRepo_UpdateSSH_Call) RunAndReturn(run func(uint, bool) error) *SafeRepo_UpdateSSH_Call { +func (_c *SafeRepo_UpdateSSH_Call) RunAndReturn(run func(context.Context, uint, bool) error) *SafeRepo_UpdateSSH_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/SettingRepo.go b/mocks/biz/SettingRepo.go index b60d7695..60758c03 100644 --- a/mocks/biz/SettingRepo.go +++ b/mocks/biz/SettingRepo.go @@ -3,7 +3,10 @@ package biz import ( + context "context" + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" request "github.com/acepanel/panel/internal/http/request" @@ -551,9 +554,9 @@ func (_c *SettingRepo_UpdateCert_Call) RunAndReturn(run func(*request.SettingCer return _c } -// UpdatePanel provides a mock function with given fields: req -func (_m *SettingRepo) UpdatePanel(req *request.SettingPanel) (bool, error) { - ret := _m.Called(req) +// UpdatePanel provides a mock function with given fields: ctx, req +func (_m *SettingRepo) UpdatePanel(ctx context.Context, req *request.SettingPanel) (bool, error) { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for UpdatePanel") @@ -561,17 +564,17 @@ func (_m *SettingRepo) UpdatePanel(req *request.SettingPanel) (bool, error) { var r0 bool var r1 error - if rf, ok := ret.Get(0).(func(*request.SettingPanel) (bool, error)); ok { - return rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.SettingPanel) (bool, error)); ok { + return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(*request.SettingPanel) bool); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.SettingPanel) bool); ok { + r0 = rf(ctx, req) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(*request.SettingPanel) error); ok { - r1 = rf(req) + if rf, ok := ret.Get(1).(func(context.Context, *request.SettingPanel) error); ok { + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -585,14 +588,15 @@ type SettingRepo_UpdatePanel_Call struct { } // UpdatePanel is a helper method to define mock.On call +// - ctx context.Context // - req *request.SettingPanel -func (_e *SettingRepo_Expecter) UpdatePanel(req interface{}) *SettingRepo_UpdatePanel_Call { - return &SettingRepo_UpdatePanel_Call{Call: _e.mock.On("UpdatePanel", req)} +func (_e *SettingRepo_Expecter) UpdatePanel(ctx interface{}, req interface{}) *SettingRepo_UpdatePanel_Call { + return &SettingRepo_UpdatePanel_Call{Call: _e.mock.On("UpdatePanel", ctx, req)} } -func (_c *SettingRepo_UpdatePanel_Call) Run(run func(req *request.SettingPanel)) *SettingRepo_UpdatePanel_Call { +func (_c *SettingRepo_UpdatePanel_Call) Run(run func(ctx context.Context, req *request.SettingPanel)) *SettingRepo_UpdatePanel_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.SettingPanel)) + run(args[0].(context.Context), args[1].(*request.SettingPanel)) }) return _c } @@ -602,7 +606,7 @@ func (_c *SettingRepo_UpdatePanel_Call) Return(_a0 bool, _a1 error) *SettingRepo return _c } -func (_c *SettingRepo_UpdatePanel_Call) RunAndReturn(run func(*request.SettingPanel) (bool, error)) *SettingRepo_UpdatePanel_Call { +func (_c *SettingRepo_UpdatePanel_Call) RunAndReturn(run func(context.Context, *request.SettingPanel) (bool, error)) *SettingRepo_UpdatePanel_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/UserRepo.go b/mocks/biz/UserRepo.go index 8abcb6f2..065bf4c8 100644 --- a/mocks/biz/UserRepo.go +++ b/mocks/biz/UserRepo.go @@ -3,10 +3,12 @@ package biz import ( - image "image" + context "context" biz "github.com/acepanel/panel/internal/biz" + image "image" + mock "github.com/stretchr/testify/mock" ) @@ -82,9 +84,9 @@ func (_c *UserRepo_CheckPassword_Call) RunAndReturn(run func(string, string) (*b return _c } -// Create provides a mock function with given fields: username, password, email -func (_m *UserRepo) Create(username string, password string, email string) (*biz.User, error) { - ret := _m.Called(username, password, email) +// Create provides a mock function with given fields: ctx, username, password, email +func (_m *UserRepo) Create(ctx context.Context, username string, password string, email string) (*biz.User, error) { + ret := _m.Called(ctx, username, password, email) if len(ret) == 0 { panic("no return value specified for Create") @@ -92,19 +94,19 @@ func (_m *UserRepo) Create(username string, password string, email string) (*biz var r0 *biz.User var r1 error - if rf, ok := ret.Get(0).(func(string, string, string) (*biz.User, error)); ok { - return rf(username, password, email) + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) (*biz.User, error)); ok { + return rf(ctx, username, password, email) } - if rf, ok := ret.Get(0).(func(string, string, string) *biz.User); ok { - r0 = rf(username, password, email) + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *biz.User); ok { + r0 = rf(ctx, username, password, email) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*biz.User) } } - if rf, ok := ret.Get(1).(func(string, string, string) error); ok { - r1 = rf(username, password, email) + if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok { + r1 = rf(ctx, username, password, email) } else { r1 = ret.Error(1) } @@ -118,16 +120,17 @@ type UserRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - username string // - password string // - email string -func (_e *UserRepo_Expecter) Create(username interface{}, password interface{}, email interface{}) *UserRepo_Create_Call { - return &UserRepo_Create_Call{Call: _e.mock.On("Create", username, password, email)} +func (_e *UserRepo_Expecter) Create(ctx interface{}, username interface{}, password interface{}, email interface{}) *UserRepo_Create_Call { + return &UserRepo_Create_Call{Call: _e.mock.On("Create", ctx, username, password, email)} } -func (_c *UserRepo_Create_Call) Run(run func(username string, password string, email string)) *UserRepo_Create_Call { +func (_c *UserRepo_Create_Call) Run(run func(ctx context.Context, username string, password string, email string)) *UserRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string), args[2].(string)) + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(string)) }) return _c } @@ -137,22 +140,22 @@ func (_c *UserRepo_Create_Call) Return(_a0 *biz.User, _a1 error) *UserRepo_Creat return _c } -func (_c *UserRepo_Create_Call) RunAndReturn(run func(string, string, string) (*biz.User, error)) *UserRepo_Create_Call { +func (_c *UserRepo_Create_Call) RunAndReturn(run func(context.Context, string, string, string) (*biz.User, error)) *UserRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: id -func (_m *UserRepo) Delete(id uint) error { - ret := _m.Called(id) +// Delete provides a mock function with given fields: ctx, id +func (_m *UserRepo) Delete(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint) error); ok { - r0 = rf(id) + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) } else { r0 = ret.Error(0) } @@ -166,14 +169,15 @@ type UserRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - id uint -func (_e *UserRepo_Expecter) Delete(id interface{}) *UserRepo_Delete_Call { - return &UserRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +func (_e *UserRepo_Expecter) Delete(ctx interface{}, id interface{}) *UserRepo_Delete_Call { + return &UserRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, id)} } -func (_c *UserRepo_Delete_Call) Run(run func(id uint)) *UserRepo_Delete_Call { +func (_c *UserRepo_Delete_Call) Run(run func(ctx context.Context, id uint)) *UserRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint)) + run(args[0].(context.Context), args[1].(uint)) }) return _c } @@ -183,7 +187,7 @@ func (_c *UserRepo_Delete_Call) Return(_a0 error) *UserRepo_Delete_Call { return _c } -func (_c *UserRepo_Delete_Call) RunAndReturn(run func(uint) error) *UserRepo_Delete_Call { +func (_c *UserRepo_Delete_Call) RunAndReturn(run func(context.Context, uint) error) *UserRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -440,17 +444,17 @@ func (_c *UserRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.User, in return _c } -// UpdateEmail provides a mock function with given fields: id, email -func (_m *UserRepo) UpdateEmail(id uint, email string) error { - ret := _m.Called(id, email) +// UpdateEmail provides a mock function with given fields: ctx, id, email +func (_m *UserRepo) UpdateEmail(ctx context.Context, id uint, email string) error { + ret := _m.Called(ctx, id, email) if len(ret) == 0 { panic("no return value specified for UpdateEmail") } var r0 error - if rf, ok := ret.Get(0).(func(uint, string) error); ok { - r0 = rf(id, email) + if rf, ok := ret.Get(0).(func(context.Context, uint, string) error); ok { + r0 = rf(ctx, id, email) } else { r0 = ret.Error(0) } @@ -464,15 +468,16 @@ type UserRepo_UpdateEmail_Call struct { } // UpdateEmail is a helper method to define mock.On call +// - ctx context.Context // - id uint // - email string -func (_e *UserRepo_Expecter) UpdateEmail(id interface{}, email interface{}) *UserRepo_UpdateEmail_Call { - return &UserRepo_UpdateEmail_Call{Call: _e.mock.On("UpdateEmail", id, email)} +func (_e *UserRepo_Expecter) UpdateEmail(ctx interface{}, id interface{}, email interface{}) *UserRepo_UpdateEmail_Call { + return &UserRepo_UpdateEmail_Call{Call: _e.mock.On("UpdateEmail", ctx, id, email)} } -func (_c *UserRepo_UpdateEmail_Call) Run(run func(id uint, email string)) *UserRepo_UpdateEmail_Call { +func (_c *UserRepo_UpdateEmail_Call) Run(run func(ctx context.Context, id uint, email string)) *UserRepo_UpdateEmail_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint), args[1].(string)) + run(args[0].(context.Context), args[1].(uint), args[2].(string)) }) return _c } @@ -482,22 +487,22 @@ func (_c *UserRepo_UpdateEmail_Call) Return(_a0 error) *UserRepo_UpdateEmail_Cal return _c } -func (_c *UserRepo_UpdateEmail_Call) RunAndReturn(run func(uint, string) error) *UserRepo_UpdateEmail_Call { +func (_c *UserRepo_UpdateEmail_Call) RunAndReturn(run func(context.Context, uint, string) error) *UserRepo_UpdateEmail_Call { _c.Call.Return(run) return _c } -// UpdatePassword provides a mock function with given fields: id, password -func (_m *UserRepo) UpdatePassword(id uint, password string) error { - ret := _m.Called(id, password) +// UpdatePassword provides a mock function with given fields: ctx, id, password +func (_m *UserRepo) UpdatePassword(ctx context.Context, id uint, password string) error { + ret := _m.Called(ctx, id, password) if len(ret) == 0 { panic("no return value specified for UpdatePassword") } var r0 error - if rf, ok := ret.Get(0).(func(uint, string) error); ok { - r0 = rf(id, password) + if rf, ok := ret.Get(0).(func(context.Context, uint, string) error); ok { + r0 = rf(ctx, id, password) } else { r0 = ret.Error(0) } @@ -511,15 +516,16 @@ type UserRepo_UpdatePassword_Call struct { } // UpdatePassword is a helper method to define mock.On call +// - ctx context.Context // - id uint // - password string -func (_e *UserRepo_Expecter) UpdatePassword(id interface{}, password interface{}) *UserRepo_UpdatePassword_Call { - return &UserRepo_UpdatePassword_Call{Call: _e.mock.On("UpdatePassword", id, password)} +func (_e *UserRepo_Expecter) UpdatePassword(ctx interface{}, id interface{}, password interface{}) *UserRepo_UpdatePassword_Call { + return &UserRepo_UpdatePassword_Call{Call: _e.mock.On("UpdatePassword", ctx, id, password)} } -func (_c *UserRepo_UpdatePassword_Call) Run(run func(id uint, password string)) *UserRepo_UpdatePassword_Call { +func (_c *UserRepo_UpdatePassword_Call) Run(run func(ctx context.Context, id uint, password string)) *UserRepo_UpdatePassword_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint), args[1].(string)) + run(args[0].(context.Context), args[1].(uint), args[2].(string)) }) return _c } @@ -529,7 +535,7 @@ func (_c *UserRepo_UpdatePassword_Call) Return(_a0 error) *UserRepo_UpdatePasswo return _c } -func (_c *UserRepo_UpdatePassword_Call) RunAndReturn(run func(uint, string) error) *UserRepo_UpdatePassword_Call { +func (_c *UserRepo_UpdatePassword_Call) RunAndReturn(run func(context.Context, uint, string) error) *UserRepo_UpdatePassword_Call { _c.Call.Return(run) return _c } @@ -582,17 +588,17 @@ func (_c *UserRepo_UpdateTwoFA_Call) RunAndReturn(run func(uint, string, string) return _c } -// UpdateUsername provides a mock function with given fields: id, username -func (_m *UserRepo) UpdateUsername(id uint, username string) error { - ret := _m.Called(id, username) +// UpdateUsername provides a mock function with given fields: ctx, id, username +func (_m *UserRepo) UpdateUsername(ctx context.Context, id uint, username string) error { + ret := _m.Called(ctx, id, username) if len(ret) == 0 { panic("no return value specified for UpdateUsername") } var r0 error - if rf, ok := ret.Get(0).(func(uint, string) error); ok { - r0 = rf(id, username) + if rf, ok := ret.Get(0).(func(context.Context, uint, string) error); ok { + r0 = rf(ctx, id, username) } else { r0 = ret.Error(0) } @@ -606,15 +612,16 @@ type UserRepo_UpdateUsername_Call struct { } // UpdateUsername is a helper method to define mock.On call +// - ctx context.Context // - id uint // - username string -func (_e *UserRepo_Expecter) UpdateUsername(id interface{}, username interface{}) *UserRepo_UpdateUsername_Call { - return &UserRepo_UpdateUsername_Call{Call: _e.mock.On("UpdateUsername", id, username)} +func (_e *UserRepo_Expecter) UpdateUsername(ctx interface{}, id interface{}, username interface{}) *UserRepo_UpdateUsername_Call { + return &UserRepo_UpdateUsername_Call{Call: _e.mock.On("UpdateUsername", ctx, id, username)} } -func (_c *UserRepo_UpdateUsername_Call) Run(run func(id uint, username string)) *UserRepo_UpdateUsername_Call { +func (_c *UserRepo_UpdateUsername_Call) Run(run func(ctx context.Context, id uint, username string)) *UserRepo_UpdateUsername_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint), args[1].(string)) + run(args[0].(context.Context), args[1].(uint), args[2].(string)) }) return _c } @@ -624,7 +631,7 @@ func (_c *UserRepo_UpdateUsername_Call) Return(_a0 error) *UserRepo_UpdateUserna return _c } -func (_c *UserRepo_UpdateUsername_Call) RunAndReturn(run func(uint, string) error) *UserRepo_UpdateUsername_Call { +func (_c *UserRepo_UpdateUsername_Call) RunAndReturn(run func(context.Context, uint, string) error) *UserRepo_UpdateUsername_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/WebHookRepo.go b/mocks/biz/WebHookRepo.go index b8c553a2..07e00b91 100644 --- a/mocks/biz/WebHookRepo.go +++ b/mocks/biz/WebHookRepo.go @@ -3,7 +3,10 @@ package biz import ( + context "context" + biz "github.com/acepanel/panel/internal/biz" + mock "github.com/stretchr/testify/mock" request "github.com/acepanel/panel/internal/http/request" @@ -78,9 +81,9 @@ func (_c *WebHookRepo_Call_Call) RunAndReturn(run func(string) (string, error)) return _c } -// Create provides a mock function with given fields: req -func (_m *WebHookRepo) Create(req *request.WebHookCreate) (*biz.WebHook, error) { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *WebHookRepo) Create(ctx context.Context, req *request.WebHookCreate) (*biz.WebHook, error) { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") @@ -88,19 +91,19 @@ func (_m *WebHookRepo) Create(req *request.WebHookCreate) (*biz.WebHook, error) var r0 *biz.WebHook var r1 error - if rf, ok := ret.Get(0).(func(*request.WebHookCreate) (*biz.WebHook, error)); ok { - return rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.WebHookCreate) (*biz.WebHook, error)); ok { + return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(*request.WebHookCreate) *biz.WebHook); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.WebHookCreate) *biz.WebHook); ok { + r0 = rf(ctx, req) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*biz.WebHook) } } - if rf, ok := ret.Get(1).(func(*request.WebHookCreate) error); ok { - r1 = rf(req) + if rf, ok := ret.Get(1).(func(context.Context, *request.WebHookCreate) error); ok { + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -114,14 +117,15 @@ type WebHookRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.WebHookCreate -func (_e *WebHookRepo_Expecter) Create(req interface{}) *WebHookRepo_Create_Call { - return &WebHookRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *WebHookRepo_Expecter) Create(ctx interface{}, req interface{}) *WebHookRepo_Create_Call { + return &WebHookRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *WebHookRepo_Create_Call) Run(run func(req *request.WebHookCreate)) *WebHookRepo_Create_Call { +func (_c *WebHookRepo_Create_Call) Run(run func(ctx context.Context, req *request.WebHookCreate)) *WebHookRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.WebHookCreate)) + run(args[0].(context.Context), args[1].(*request.WebHookCreate)) }) return _c } @@ -131,22 +135,22 @@ func (_c *WebHookRepo_Create_Call) Return(_a0 *biz.WebHook, _a1 error) *WebHookR return _c } -func (_c *WebHookRepo_Create_Call) RunAndReturn(run func(*request.WebHookCreate) (*biz.WebHook, error)) *WebHookRepo_Create_Call { +func (_c *WebHookRepo_Create_Call) RunAndReturn(run func(context.Context, *request.WebHookCreate) (*biz.WebHook, error)) *WebHookRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: id -func (_m *WebHookRepo) Delete(id uint) error { - ret := _m.Called(id) +// Delete provides a mock function with given fields: ctx, id +func (_m *WebHookRepo) Delete(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(uint) error); ok { - r0 = rf(id) + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) } else { r0 = ret.Error(0) } @@ -160,14 +164,15 @@ type WebHookRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - id uint -func (_e *WebHookRepo_Expecter) Delete(id interface{}) *WebHookRepo_Delete_Call { - return &WebHookRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +func (_e *WebHookRepo_Expecter) Delete(ctx interface{}, id interface{}) *WebHookRepo_Delete_Call { + return &WebHookRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, id)} } -func (_c *WebHookRepo_Delete_Call) Run(run func(id uint)) *WebHookRepo_Delete_Call { +func (_c *WebHookRepo_Delete_Call) Run(run func(ctx context.Context, id uint)) *WebHookRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(uint)) + run(args[0].(context.Context), args[1].(uint)) }) return _c } @@ -177,7 +182,7 @@ func (_c *WebHookRepo_Delete_Call) Return(_a0 error) *WebHookRepo_Delete_Call { return _c } -func (_c *WebHookRepo_Delete_Call) RunAndReturn(run func(uint) error) *WebHookRepo_Delete_Call { +func (_c *WebHookRepo_Delete_Call) RunAndReturn(run func(context.Context, uint) error) *WebHookRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -364,17 +369,17 @@ func (_c *WebHookRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.WebHo return _c } -// Update provides a mock function with given fields: req -func (_m *WebHookRepo) Update(req *request.WebHookUpdate) error { - ret := _m.Called(req) +// Update provides a mock function with given fields: ctx, req +func (_m *WebHookRepo) Update(ctx context.Context, req *request.WebHookUpdate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if rf, ok := ret.Get(0).(func(*request.WebHookUpdate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.WebHookUpdate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -388,14 +393,15 @@ type WebHookRepo_Update_Call struct { } // Update is a helper method to define mock.On call +// - ctx context.Context // - req *request.WebHookUpdate -func (_e *WebHookRepo_Expecter) Update(req interface{}) *WebHookRepo_Update_Call { - return &WebHookRepo_Update_Call{Call: _e.mock.On("Update", req)} +func (_e *WebHookRepo_Expecter) Update(ctx interface{}, req interface{}) *WebHookRepo_Update_Call { + return &WebHookRepo_Update_Call{Call: _e.mock.On("Update", ctx, req)} } -func (_c *WebHookRepo_Update_Call) Run(run func(req *request.WebHookUpdate)) *WebHookRepo_Update_Call { +func (_c *WebHookRepo_Update_Call) Run(run func(ctx context.Context, req *request.WebHookUpdate)) *WebHookRepo_Update_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.WebHookUpdate)) + run(args[0].(context.Context), args[1].(*request.WebHookUpdate)) }) return _c } @@ -405,7 +411,7 @@ func (_c *WebHookRepo_Update_Call) Return(_a0 error) *WebHookRepo_Update_Call { return _c } -func (_c *WebHookRepo_Update_Call) RunAndReturn(run func(*request.WebHookUpdate) error) *WebHookRepo_Update_Call { +func (_c *WebHookRepo_Update_Call) RunAndReturn(run func(context.Context, *request.WebHookUpdate) error) *WebHookRepo_Update_Call { _c.Call.Return(run) return _c } diff --git a/mocks/biz/WebsiteRepo.go b/mocks/biz/WebsiteRepo.go index 221fda50..a18725cd 100644 --- a/mocks/biz/WebsiteRepo.go +++ b/mocks/biz/WebsiteRepo.go @@ -128,9 +128,9 @@ func (_c *WebsiteRepo_Count_Call) RunAndReturn(run func() (int64, error)) *Websi return _c } -// Create provides a mock function with given fields: req -func (_m *WebsiteRepo) Create(req *request.WebsiteCreate) (*biz.Website, error) { - ret := _m.Called(req) +// Create provides a mock function with given fields: ctx, req +func (_m *WebsiteRepo) Create(ctx context.Context, req *request.WebsiteCreate) (*biz.Website, error) { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Create") @@ -138,19 +138,19 @@ func (_m *WebsiteRepo) Create(req *request.WebsiteCreate) (*biz.Website, error) var r0 *biz.Website var r1 error - if rf, ok := ret.Get(0).(func(*request.WebsiteCreate) (*biz.Website, error)); ok { - return rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.WebsiteCreate) (*biz.Website, error)); ok { + return rf(ctx, req) } - if rf, ok := ret.Get(0).(func(*request.WebsiteCreate) *biz.Website); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.WebsiteCreate) *biz.Website); ok { + r0 = rf(ctx, req) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*biz.Website) } } - if rf, ok := ret.Get(1).(func(*request.WebsiteCreate) error); ok { - r1 = rf(req) + if rf, ok := ret.Get(1).(func(context.Context, *request.WebsiteCreate) error); ok { + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -164,14 +164,15 @@ type WebsiteRepo_Create_Call struct { } // Create is a helper method to define mock.On call +// - ctx context.Context // - req *request.WebsiteCreate -func (_e *WebsiteRepo_Expecter) Create(req interface{}) *WebsiteRepo_Create_Call { - return &WebsiteRepo_Create_Call{Call: _e.mock.On("Create", req)} +func (_e *WebsiteRepo_Expecter) Create(ctx interface{}, req interface{}) *WebsiteRepo_Create_Call { + return &WebsiteRepo_Create_Call{Call: _e.mock.On("Create", ctx, req)} } -func (_c *WebsiteRepo_Create_Call) Run(run func(req *request.WebsiteCreate)) *WebsiteRepo_Create_Call { +func (_c *WebsiteRepo_Create_Call) Run(run func(ctx context.Context, req *request.WebsiteCreate)) *WebsiteRepo_Create_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.WebsiteCreate)) + run(args[0].(context.Context), args[1].(*request.WebsiteCreate)) }) return _c } @@ -181,22 +182,22 @@ func (_c *WebsiteRepo_Create_Call) Return(_a0 *biz.Website, _a1 error) *WebsiteR return _c } -func (_c *WebsiteRepo_Create_Call) RunAndReturn(run func(*request.WebsiteCreate) (*biz.Website, error)) *WebsiteRepo_Create_Call { +func (_c *WebsiteRepo_Create_Call) RunAndReturn(run func(context.Context, *request.WebsiteCreate) (*biz.Website, error)) *WebsiteRepo_Create_Call { _c.Call.Return(run) return _c } -// Delete provides a mock function with given fields: req -func (_m *WebsiteRepo) Delete(req *request.WebsiteDelete) error { - ret := _m.Called(req) +// Delete provides a mock function with given fields: ctx, req +func (_m *WebsiteRepo) Delete(ctx context.Context, req *request.WebsiteDelete) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error - if rf, ok := ret.Get(0).(func(*request.WebsiteDelete) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.WebsiteDelete) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -210,14 +211,15 @@ type WebsiteRepo_Delete_Call struct { } // Delete is a helper method to define mock.On call +// - ctx context.Context // - req *request.WebsiteDelete -func (_e *WebsiteRepo_Expecter) Delete(req interface{}) *WebsiteRepo_Delete_Call { - return &WebsiteRepo_Delete_Call{Call: _e.mock.On("Delete", req)} +func (_e *WebsiteRepo_Expecter) Delete(ctx interface{}, req interface{}) *WebsiteRepo_Delete_Call { + return &WebsiteRepo_Delete_Call{Call: _e.mock.On("Delete", ctx, req)} } -func (_c *WebsiteRepo_Delete_Call) Run(run func(req *request.WebsiteDelete)) *WebsiteRepo_Delete_Call { +func (_c *WebsiteRepo_Delete_Call) Run(run func(ctx context.Context, req *request.WebsiteDelete)) *WebsiteRepo_Delete_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.WebsiteDelete)) + run(args[0].(context.Context), args[1].(*request.WebsiteDelete)) }) return _c } @@ -227,7 +229,7 @@ func (_c *WebsiteRepo_Delete_Call) Return(_a0 error) *WebsiteRepo_Delete_Call { return _c } -func (_c *WebsiteRepo_Delete_Call) RunAndReturn(run func(*request.WebsiteDelete) error) *WebsiteRepo_Delete_Call { +func (_c *WebsiteRepo_Delete_Call) RunAndReturn(run func(context.Context, *request.WebsiteDelete) error) *WebsiteRepo_Delete_Call { _c.Call.Return(run) return _c } @@ -565,17 +567,17 @@ func (_c *WebsiteRepo_ResetConfig_Call) RunAndReturn(run func(uint) error) *Webs return _c } -// Update provides a mock function with given fields: req -func (_m *WebsiteRepo) Update(req *request.WebsiteUpdate) error { - ret := _m.Called(req) +// Update provides a mock function with given fields: ctx, req +func (_m *WebsiteRepo) Update(ctx context.Context, req *request.WebsiteUpdate) error { + ret := _m.Called(ctx, req) if len(ret) == 0 { panic("no return value specified for Update") } var r0 error - if rf, ok := ret.Get(0).(func(*request.WebsiteUpdate) error); ok { - r0 = rf(req) + if rf, ok := ret.Get(0).(func(context.Context, *request.WebsiteUpdate) error); ok { + r0 = rf(ctx, req) } else { r0 = ret.Error(0) } @@ -589,14 +591,15 @@ type WebsiteRepo_Update_Call struct { } // Update is a helper method to define mock.On call +// - ctx context.Context // - req *request.WebsiteUpdate -func (_e *WebsiteRepo_Expecter) Update(req interface{}) *WebsiteRepo_Update_Call { - return &WebsiteRepo_Update_Call{Call: _e.mock.On("Update", req)} +func (_e *WebsiteRepo_Expecter) Update(ctx interface{}, req interface{}) *WebsiteRepo_Update_Call { + return &WebsiteRepo_Update_Call{Call: _e.mock.On("Update", ctx, req)} } -func (_c *WebsiteRepo_Update_Call) Run(run func(req *request.WebsiteUpdate)) *WebsiteRepo_Update_Call { +func (_c *WebsiteRepo_Update_Call) Run(run func(ctx context.Context, req *request.WebsiteUpdate)) *WebsiteRepo_Update_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*request.WebsiteUpdate)) + run(args[0].(context.Context), args[1].(*request.WebsiteUpdate)) }) return _c } @@ -606,7 +609,7 @@ func (_c *WebsiteRepo_Update_Call) Return(_a0 error) *WebsiteRepo_Update_Call { return _c } -func (_c *WebsiteRepo_Update_Call) RunAndReturn(run func(*request.WebsiteUpdate) error) *WebsiteRepo_Update_Call { +func (_c *WebsiteRepo_Update_Call) RunAndReturn(run func(context.Context, *request.WebsiteUpdate) error) *WebsiteRepo_Update_Call { _c.Call.Return(run) return _c }