|
@@ -2313,6 +2313,9 @@ type MockUsersStore struct {
|
|
|
|
|
|
|
|
|
HasForkedRepositoryFunc *UsersStoreHasForkedRepositoryFunc
|
|
|
+
|
|
|
+
|
|
|
+ IsUsernameUsedFunc *UsersStoreIsUsernameUsedFunc
|
|
|
|
|
|
|
|
|
ListFollowersFunc *UsersStoreListFollowersFunc
|
|
@@ -2363,6 +2366,11 @@ func NewMockUsersStore() *MockUsersStore {
|
|
|
return
|
|
|
},
|
|
|
},
|
|
|
+ IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
|
|
|
+ defaultHook: func(context.Context, string) (r0 bool) {
|
|
|
+ return
|
|
|
+ },
|
|
|
+ },
|
|
|
ListFollowersFunc: &UsersStoreListFollowersFunc{
|
|
|
defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
|
|
|
return
|
|
@@ -2420,6 +2428,11 @@ func NewStrictMockUsersStore() *MockUsersStore {
|
|
|
panic("unexpected invocation of MockUsersStore.HasForkedRepository")
|
|
|
},
|
|
|
},
|
|
|
+ IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
|
|
|
+ defaultHook: func(context.Context, string) bool {
|
|
|
+ panic("unexpected invocation of MockUsersStore.IsUsernameUsed")
|
|
|
+ },
|
|
|
+ },
|
|
|
ListFollowersFunc: &UsersStoreListFollowersFunc{
|
|
|
defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
|
|
|
panic("unexpected invocation of MockUsersStore.ListFollowers")
|
|
@@ -2463,6 +2476,9 @@ func NewMockUsersStoreFrom(i db.UsersStore) *MockUsersStore {
|
|
|
HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
|
|
|
defaultHook: i.HasForkedRepository,
|
|
|
},
|
|
|
+ IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
|
|
|
+ defaultHook: i.IsUsernameUsed,
|
|
|
+ },
|
|
|
ListFollowersFunc: &UsersStoreListFollowersFunc{
|
|
|
defaultHook: i.ListFollowers,
|
|
|
},
|
|
@@ -3242,6 +3258,111 @@ func (c UsersStoreHasForkedRepositoryFuncCall) Results() []interface{} {
|
|
|
return []interface{}{c.Result0}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+type UsersStoreIsUsernameUsedFunc struct {
|
|
|
+ defaultHook func(context.Context, string) bool
|
|
|
+ hooks []func(context.Context, string) bool
|
|
|
+ history []UsersStoreIsUsernameUsedFuncCall
|
|
|
+ mutex sync.Mutex
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *MockUsersStore) IsUsernameUsed(v0 context.Context, v1 string) bool {
|
|
|
+ r0 := m.IsUsernameUsedFunc.nextHook()(v0, v1)
|
|
|
+ m.IsUsernameUsedFunc.appendCall(UsersStoreIsUsernameUsedFuncCall{v0, v1, r0})
|
|
|
+ return r0
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreIsUsernameUsedFunc) SetDefaultHook(hook func(context.Context, string) bool) {
|
|
|
+ f.defaultHook = hook
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreIsUsernameUsedFunc) PushHook(hook func(context.Context, string) bool) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.hooks = append(f.hooks, hook)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreIsUsernameUsedFunc) SetDefaultReturn(r0 bool) {
|
|
|
+ f.SetDefaultHook(func(context.Context, string) bool {
|
|
|
+ return r0
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreIsUsernameUsedFunc) PushReturn(r0 bool) {
|
|
|
+ f.PushHook(func(context.Context, string) bool {
|
|
|
+ return r0
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func (f *UsersStoreIsUsernameUsedFunc) nextHook() func(context.Context, string) 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 *UsersStoreIsUsernameUsedFunc) appendCall(r0 UsersStoreIsUsernameUsedFuncCall) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.history = append(f.history, r0)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreIsUsernameUsedFunc) History() []UsersStoreIsUsernameUsedFuncCall {
|
|
|
+ f.mutex.Lock()
|
|
|
+ history := make([]UsersStoreIsUsernameUsedFuncCall, len(f.history))
|
|
|
+ copy(history, f.history)
|
|
|
+ f.mutex.Unlock()
|
|
|
+
|
|
|
+ return history
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type UsersStoreIsUsernameUsedFuncCall struct {
|
|
|
+
|
|
|
+
|
|
|
+ Arg0 context.Context
|
|
|
+
|
|
|
+
|
|
|
+ Arg1 string
|
|
|
+
|
|
|
+
|
|
|
+ Result0 bool
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c UsersStoreIsUsernameUsedFuncCall) Args() []interface{} {
|
|
|
+ return []interface{}{c.Arg0, c.Arg1}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c UsersStoreIsUsernameUsedFuncCall) Results() []interface{} {
|
|
|
+ return []interface{}{c.Result0}
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
type UsersStoreListFollowersFunc struct {
|