|
@@ -2308,6 +2308,9 @@ type MockUsersStore struct {
|
|
// GetByUsernameFunc is an instance of a mock function object
|
|
// GetByUsernameFunc is an instance of a mock function object
|
|
// controlling the behavior of the method GetByUsername.
|
|
// controlling the behavior of the method GetByUsername.
|
|
GetByUsernameFunc *UsersStoreGetByUsernameFunc
|
|
GetByUsernameFunc *UsersStoreGetByUsernameFunc
|
|
|
|
+ // HasForkedRepositoryFunc is an instance of a mock function object
|
|
|
|
+ // controlling the behavior of the method HasForkedRepository.
|
|
|
|
+ HasForkedRepositoryFunc *UsersStoreHasForkedRepositoryFunc
|
|
}
|
|
}
|
|
|
|
|
|
// NewMockUsersStore creates a new mock of the UsersStore interface. All
|
|
// NewMockUsersStore creates a new mock of the UsersStore interface. All
|
|
@@ -2339,6 +2342,11 @@ func NewMockUsersStore() *MockUsersStore {
|
|
return
|
|
return
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
|
|
|
|
+ defaultHook: func(context.Context, int64, int64) (r0 bool) {
|
|
|
|
+ return
|
|
|
|
+ },
|
|
|
|
+ },
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2371,6 +2379,11 @@ func NewStrictMockUsersStore() *MockUsersStore {
|
|
panic("unexpected invocation of MockUsersStore.GetByUsername")
|
|
panic("unexpected invocation of MockUsersStore.GetByUsername")
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
|
|
|
|
+ defaultHook: func(context.Context, int64, int64) bool {
|
|
|
|
+ panic("unexpected invocation of MockUsersStore.HasForkedRepository")
|
|
|
|
+ },
|
|
|
|
+ },
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2393,6 +2406,9 @@ func NewMockUsersStoreFrom(i db.UsersStore) *MockUsersStore {
|
|
GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
|
|
GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
|
|
defaultHook: i.GetByUsername,
|
|
defaultHook: i.GetByUsername,
|
|
},
|
|
},
|
|
|
|
+ HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
|
|
|
|
+ defaultHook: i.HasForkedRepository,
|
|
|
|
+ },
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2946,3 +2962,113 @@ func (c UsersStoreGetByUsernameFuncCall) Args() []interface{} {
|
|
func (c UsersStoreGetByUsernameFuncCall) Results() []interface{} {
|
|
func (c UsersStoreGetByUsernameFuncCall) Results() []interface{} {
|
|
return []interface{}{c.Result0, c.Result1}
|
|
return []interface{}{c.Result0, c.Result1}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// UsersStoreHasForkedRepositoryFunc describes the behavior when the
|
|
|
|
+// HasForkedRepository method of the parent MockUsersStore instance is
|
|
|
|
+// invoked.
|
|
|
|
+type UsersStoreHasForkedRepositoryFunc struct {
|
|
|
|
+ defaultHook func(context.Context, int64, int64) bool
|
|
|
|
+ hooks []func(context.Context, int64, int64) bool
|
|
|
|
+ history []UsersStoreHasForkedRepositoryFuncCall
|
|
|
|
+ mutex sync.Mutex
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// HasForkedRepository delegates to the next hook function in the queue and
|
|
|
|
+// stores the parameter and result values of this invocation.
|
|
|
|
+func (m *MockUsersStore) HasForkedRepository(v0 context.Context, v1 int64, v2 int64) bool {
|
|
|
|
+ r0 := m.HasForkedRepositoryFunc.nextHook()(v0, v1, v2)
|
|
|
|
+ m.HasForkedRepositoryFunc.appendCall(UsersStoreHasForkedRepositoryFuncCall{v0, v1, v2, r0})
|
|
|
|
+ return r0
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// SetDefaultHook sets function that is called when the HasForkedRepository
|
|
|
|
+// method of the parent MockUsersStore instance is invoked and the hook
|
|
|
|
+// queue is empty.
|
|
|
|
+func (f *UsersStoreHasForkedRepositoryFunc) SetDefaultHook(hook func(context.Context, int64, int64) bool) {
|
|
|
|
+ f.defaultHook = hook
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// PushHook adds a function to the end of hook queue. Each invocation of the
|
|
|
|
+// HasForkedRepository method of the parent MockUsersStore instance invokes
|
|
|
|
+// the hook at the front of the queue and discards it. After the queue is
|
|
|
|
+// empty, the default hook function is invoked for any future action.
|
|
|
|
+func (f *UsersStoreHasForkedRepositoryFunc) PushHook(hook func(context.Context, int64, int64) bool) {
|
|
|
|
+ f.mutex.Lock()
|
|
|
|
+ f.hooks = append(f.hooks, hook)
|
|
|
|
+ f.mutex.Unlock()
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// SetDefaultReturn calls SetDefaultHook with a function that returns the
|
|
|
|
+// given values.
|
|
|
|
+func (f *UsersStoreHasForkedRepositoryFunc) SetDefaultReturn(r0 bool) {
|
|
|
|
+ f.SetDefaultHook(func(context.Context, int64, int64) bool {
|
|
|
|
+ return r0
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// PushReturn calls PushHook with a function that returns the given values.
|
|
|
|
+func (f *UsersStoreHasForkedRepositoryFunc) PushReturn(r0 bool) {
|
|
|
|
+ f.PushHook(func(context.Context, int64, int64) bool {
|
|
|
|
+ return r0
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (f *UsersStoreHasForkedRepositoryFunc) nextHook() func(context.Context, int64, 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 *UsersStoreHasForkedRepositoryFunc) appendCall(r0 UsersStoreHasForkedRepositoryFuncCall) {
|
|
|
|
+ f.mutex.Lock()
|
|
|
|
+ f.history = append(f.history, r0)
|
|
|
|
+ f.mutex.Unlock()
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// History returns a sequence of UsersStoreHasForkedRepositoryFuncCall
|
|
|
|
+// objects describing the invocations of this function.
|
|
|
|
+func (f *UsersStoreHasForkedRepositoryFunc) History() []UsersStoreHasForkedRepositoryFuncCall {
|
|
|
|
+ f.mutex.Lock()
|
|
|
|
+ history := make([]UsersStoreHasForkedRepositoryFuncCall, len(f.history))
|
|
|
|
+ copy(history, f.history)
|
|
|
|
+ f.mutex.Unlock()
|
|
|
|
+
|
|
|
|
+ return history
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// UsersStoreHasForkedRepositoryFuncCall is an object that describes an
|
|
|
|
+// invocation of method HasForkedRepository on an instance of
|
|
|
|
+// MockUsersStore.
|
|
|
|
+type UsersStoreHasForkedRepositoryFuncCall struct {
|
|
|
|
+ // Arg0 is the value of the 1st argument passed to this method
|
|
|
|
+ // invocation.
|
|
|
|
+ Arg0 context.Context
|
|
|
|
+ // Arg1 is the value of the 2nd argument passed to this method
|
|
|
|
+ // invocation.
|
|
|
|
+ Arg1 int64
|
|
|
|
+ // Arg2 is the value of the 3rd argument passed to this method
|
|
|
|
+ // invocation.
|
|
|
|
+ Arg2 int64
|
|
|
|
+ // Result0 is the value of the 1st result returned from this method
|
|
|
|
+ // invocation.
|
|
|
|
+ Result0 bool
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// Args returns an interface slice containing the arguments of this
|
|
|
|
+// invocation.
|
|
|
|
+func (c UsersStoreHasForkedRepositoryFuncCall) Args() []interface{} {
|
|
|
|
+ return []interface{}{c.Arg0, c.Arg1, c.Arg2}
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// Results returns an interface slice containing the results of this
|
|
|
|
+// invocation.
|
|
|
|
+func (c UsersStoreHasForkedRepositoryFuncCall) Results() []interface{} {
|
|
|
|
+ return []interface{}{c.Result0}
|
|
|
|
+}
|