|
@@ -2371,6 +2371,408 @@ func (c PermsStoreSetRepoPermsFuncCall) Results() []interface{} {
|
|
|
return []interface{}{c.Result0}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type MockTwoFactorsStore struct {
|
|
|
+
|
|
|
+
|
|
|
+ CreateFunc *TwoFactorsStoreCreateFunc
|
|
|
+
|
|
|
+
|
|
|
+ GetByUserIDFunc *TwoFactorsStoreGetByUserIDFunc
|
|
|
+
|
|
|
+
|
|
|
+ IsUserEnabledFunc *TwoFactorsStoreIsUserEnabledFunc
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func NewMockTwoFactorsStore() *MockTwoFactorsStore {
|
|
|
+ return &MockTwoFactorsStore{
|
|
|
+ CreateFunc: &TwoFactorsStoreCreateFunc{
|
|
|
+ defaultHook: func(context.Context, int64, string, string) (r0 error) {
|
|
|
+ return
|
|
|
+ },
|
|
|
+ },
|
|
|
+ GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
|
|
|
+ defaultHook: func(context.Context, int64) (r0 *TwoFactor, r1 error) {
|
|
|
+ return
|
|
|
+ },
|
|
|
+ },
|
|
|
+ IsUserEnabledFunc: &TwoFactorsStoreIsUserEnabledFunc{
|
|
|
+ defaultHook: func(context.Context, int64) (r0 bool) {
|
|
|
+ return
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func NewStrictMockTwoFactorsStore() *MockTwoFactorsStore {
|
|
|
+ return &MockTwoFactorsStore{
|
|
|
+ CreateFunc: &TwoFactorsStoreCreateFunc{
|
|
|
+ defaultHook: func(context.Context, int64, string, string) error {
|
|
|
+ panic("unexpected invocation of MockTwoFactorsStore.Create")
|
|
|
+ },
|
|
|
+ },
|
|
|
+ GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
|
|
|
+ defaultHook: func(context.Context, int64) (*TwoFactor, error) {
|
|
|
+ panic("unexpected invocation of MockTwoFactorsStore.GetByUserID")
|
|
|
+ },
|
|
|
+ },
|
|
|
+ IsUserEnabledFunc: &TwoFactorsStoreIsUserEnabledFunc{
|
|
|
+ defaultHook: func(context.Context, int64) bool {
|
|
|
+ panic("unexpected invocation of MockTwoFactorsStore.IsUserEnabled")
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func NewMockTwoFactorsStoreFrom(i TwoFactorsStore) *MockTwoFactorsStore {
|
|
|
+ return &MockTwoFactorsStore{
|
|
|
+ CreateFunc: &TwoFactorsStoreCreateFunc{
|
|
|
+ defaultHook: i.Create,
|
|
|
+ },
|
|
|
+ GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
|
|
|
+ defaultHook: i.GetByUserID,
|
|
|
+ },
|
|
|
+ IsUserEnabledFunc: &TwoFactorsStoreIsUserEnabledFunc{
|
|
|
+ defaultHook: i.IsUserEnabled,
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type TwoFactorsStoreCreateFunc struct {
|
|
|
+ defaultHook func(context.Context, int64, string, string) error
|
|
|
+ hooks []func(context.Context, int64, string, string) error
|
|
|
+ history []TwoFactorsStoreCreateFuncCall
|
|
|
+ mutex sync.Mutex
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *MockTwoFactorsStore) Create(v0 context.Context, v1 int64, v2 string, v3 string) error {
|
|
|
+ r0 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
|
|
|
+ m.CreateFunc.appendCall(TwoFactorsStoreCreateFuncCall{v0, v1, v2, v3, r0})
|
|
|
+ return r0
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string, string) error) {
|
|
|
+ f.defaultHook = hook
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreCreateFunc) PushHook(hook func(context.Context, int64, string, string) error) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.hooks = append(f.hooks, hook)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreCreateFunc) SetDefaultReturn(r0 error) {
|
|
|
+ f.SetDefaultHook(func(context.Context, int64, string, string) error {
|
|
|
+ return r0
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreCreateFunc) PushReturn(r0 error) {
|
|
|
+ f.PushHook(func(context.Context, int64, string, string) error {
|
|
|
+ return r0
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreCreateFunc) nextHook() func(context.Context, int64, string, string) error {
|
|
|
+ f.mutex.Lock()
|
|
|
+ defer f.mutex.Unlock()
|
|
|
+
|
|
|
+ if len(f.hooks) == 0 {
|
|
|
+ return f.defaultHook
|
|
|
+ }
|
|
|
+
|
|
|
+ hook := f.hooks[0]
|
|
|
+ f.hooks = f.hooks[1:]
|
|
|
+ return hook
|
|
|
+}
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreCreateFunc) appendCall(r0 TwoFactorsStoreCreateFuncCall) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.history = append(f.history, r0)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreCreateFunc) History() []TwoFactorsStoreCreateFuncCall {
|
|
|
+ f.mutex.Lock()
|
|
|
+ history := make([]TwoFactorsStoreCreateFuncCall, len(f.history))
|
|
|
+ copy(history, f.history)
|
|
|
+ f.mutex.Unlock()
|
|
|
+
|
|
|
+ return history
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type TwoFactorsStoreCreateFuncCall struct {
|
|
|
+
|
|
|
+
|
|
|
+ Arg0 context.Context
|
|
|
+
|
|
|
+
|
|
|
+ Arg1 int64
|
|
|
+
|
|
|
+
|
|
|
+ Arg2 string
|
|
|
+
|
|
|
+
|
|
|
+ Arg3 string
|
|
|
+
|
|
|
+
|
|
|
+ Result0 error
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c TwoFactorsStoreCreateFuncCall) Args() []interface{} {
|
|
|
+ return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c TwoFactorsStoreCreateFuncCall) Results() []interface{} {
|
|
|
+ return []interface{}{c.Result0}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type TwoFactorsStoreGetByUserIDFunc struct {
|
|
|
+ defaultHook func(context.Context, int64) (*TwoFactor, error)
|
|
|
+ hooks []func(context.Context, int64) (*TwoFactor, error)
|
|
|
+ history []TwoFactorsStoreGetByUserIDFuncCall
|
|
|
+ mutex sync.Mutex
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *MockTwoFactorsStore) GetByUserID(v0 context.Context, v1 int64) (*TwoFactor, error) {
|
|
|
+ r0, r1 := m.GetByUserIDFunc.nextHook()(v0, v1)
|
|
|
+ m.GetByUserIDFunc.appendCall(TwoFactorsStoreGetByUserIDFuncCall{v0, v1, r0, r1})
|
|
|
+ return r0, r1
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultHook(hook func(context.Context, int64) (*TwoFactor, error)) {
|
|
|
+ f.defaultHook = hook
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreGetByUserIDFunc) PushHook(hook func(context.Context, int64) (*TwoFactor, error)) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.hooks = append(f.hooks, hook)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultReturn(r0 *TwoFactor, r1 error) {
|
|
|
+ f.SetDefaultHook(func(context.Context, int64) (*TwoFactor, error) {
|
|
|
+ return r0, r1
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreGetByUserIDFunc) PushReturn(r0 *TwoFactor, r1 error) {
|
|
|
+ f.PushHook(func(context.Context, int64) (*TwoFactor, error) {
|
|
|
+ return r0, r1
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreGetByUserIDFunc) nextHook() func(context.Context, int64) (*TwoFactor, error) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ defer f.mutex.Unlock()
|
|
|
+
|
|
|
+ if len(f.hooks) == 0 {
|
|
|
+ return f.defaultHook
|
|
|
+ }
|
|
|
+
|
|
|
+ hook := f.hooks[0]
|
|
|
+ f.hooks = f.hooks[1:]
|
|
|
+ return hook
|
|
|
+}
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreGetByUserIDFunc) appendCall(r0 TwoFactorsStoreGetByUserIDFuncCall) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.history = append(f.history, r0)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreGetByUserIDFunc) History() []TwoFactorsStoreGetByUserIDFuncCall {
|
|
|
+ f.mutex.Lock()
|
|
|
+ history := make([]TwoFactorsStoreGetByUserIDFuncCall, len(f.history))
|
|
|
+ copy(history, f.history)
|
|
|
+ f.mutex.Unlock()
|
|
|
+
|
|
|
+ return history
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type TwoFactorsStoreGetByUserIDFuncCall struct {
|
|
|
+
|
|
|
+
|
|
|
+ Arg0 context.Context
|
|
|
+
|
|
|
+
|
|
|
+ Arg1 int64
|
|
|
+
|
|
|
+
|
|
|
+ Result0 *TwoFactor
|
|
|
+
|
|
|
+
|
|
|
+ Result1 error
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c TwoFactorsStoreGetByUserIDFuncCall) Args() []interface{} {
|
|
|
+ return []interface{}{c.Arg0, c.Arg1}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c TwoFactorsStoreGetByUserIDFuncCall) Results() []interface{} {
|
|
|
+ return []interface{}{c.Result0, c.Result1}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type TwoFactorsStoreIsUserEnabledFunc struct {
|
|
|
+ defaultHook func(context.Context, int64) bool
|
|
|
+ hooks []func(context.Context, int64) bool
|
|
|
+ history []TwoFactorsStoreIsUserEnabledFuncCall
|
|
|
+ mutex sync.Mutex
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *MockTwoFactorsStore) IsUserEnabled(v0 context.Context, v1 int64) bool {
|
|
|
+ r0 := m.IsUserEnabledFunc.nextHook()(v0, v1)
|
|
|
+ m.IsUserEnabledFunc.appendCall(TwoFactorsStoreIsUserEnabledFuncCall{v0, v1, r0})
|
|
|
+ return r0
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreIsUserEnabledFunc) SetDefaultHook(hook func(context.Context, int64) bool) {
|
|
|
+ f.defaultHook = hook
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreIsUserEnabledFunc) PushHook(hook func(context.Context, int64) bool) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.hooks = append(f.hooks, hook)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreIsUserEnabledFunc) SetDefaultReturn(r0 bool) {
|
|
|
+ f.SetDefaultHook(func(context.Context, int64) bool {
|
|
|
+ return r0
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreIsUserEnabledFunc) PushReturn(r0 bool) {
|
|
|
+ f.PushHook(func(context.Context, int64) bool {
|
|
|
+ return r0
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreIsUserEnabledFunc) nextHook() func(context.Context, int64) bool {
|
|
|
+ f.mutex.Lock()
|
|
|
+ defer f.mutex.Unlock()
|
|
|
+
|
|
|
+ if len(f.hooks) == 0 {
|
|
|
+ return f.defaultHook
|
|
|
+ }
|
|
|
+
|
|
|
+ hook := f.hooks[0]
|
|
|
+ f.hooks = f.hooks[1:]
|
|
|
+ return hook
|
|
|
+}
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreIsUserEnabledFunc) appendCall(r0 TwoFactorsStoreIsUserEnabledFuncCall) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.history = append(f.history, r0)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *TwoFactorsStoreIsUserEnabledFunc) History() []TwoFactorsStoreIsUserEnabledFuncCall {
|
|
|
+ f.mutex.Lock()
|
|
|
+ history := make([]TwoFactorsStoreIsUserEnabledFuncCall, len(f.history))
|
|
|
+ copy(history, f.history)
|
|
|
+ f.mutex.Unlock()
|
|
|
+
|
|
|
+ return history
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type TwoFactorsStoreIsUserEnabledFuncCall struct {
|
|
|
+
|
|
|
+
|
|
|
+ Arg0 context.Context
|
|
|
+
|
|
|
+
|
|
|
+ Arg1 int64
|
|
|
+
|
|
|
+
|
|
|
+ Result0 bool
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c TwoFactorsStoreIsUserEnabledFuncCall) Args() []interface{} {
|
|
|
+ return []interface{}{c.Arg0, c.Arg1}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c TwoFactorsStoreIsUserEnabledFuncCall) Results() []interface{} {
|
|
|
+ return []interface{}{c.Result0}
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
type MockUsersStore struct {
|