From 014a0c66533e7af060c478aadb73a24a2932a138 Mon Sep 17 00:00:00 2001 From: Adphi Date: Fri, 11 Jan 2019 19:43:04 +0100 Subject: [PATCH] Added mocks --- types/mocks/Apps.go | 129 +++++++++++ types/mocks/AppsConfig.go | 151 ++++++++++++ types/mocks/Auth.go | 38 +++ types/mocks/Client.go | 44 ++++ types/mocks/GroupFolders.go | 146 ++++++++++++ types/mocks/Groups.go | 154 +++++++++++++ types/mocks/Notifications.go | 125 ++++++++++ types/mocks/Shares.go | 183 +++++++++++++++ types/mocks/Users.go | 436 +++++++++++++++++++++++++++++++++++ 9 files changed, 1406 insertions(+) create mode 100644 types/mocks/Apps.go create mode 100644 types/mocks/AppsConfig.go create mode 100644 types/mocks/Auth.go create mode 100644 types/mocks/Client.go create mode 100644 types/mocks/GroupFolders.go create mode 100644 types/mocks/Groups.go create mode 100644 types/mocks/Notifications.go create mode 100644 types/mocks/Shares.go create mode 100644 types/mocks/Users.go diff --git a/types/mocks/Apps.go b/types/mocks/Apps.go new file mode 100644 index 0000000..7118743 --- /dev/null +++ b/types/mocks/Apps.go @@ -0,0 +1,129 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import types "gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud/types" + +// Apps is an autogenerated mock type for the Apps type +type Apps struct { + mock.Mock +} + +// Disable provides a mock function with given fields: name +func (_m *Apps) Disable(name string) error { + ret := _m.Called(name) + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Enable provides a mock function with given fields: name +func (_m *Apps) Enable(name string) error { + ret := _m.Called(name) + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Infos provides a mock function with given fields: name +func (_m *Apps) Infos(name string) (types.App, error) { + ret := _m.Called(name) + + var r0 types.App + if rf, ok := ret.Get(0).(func(string) types.App); ok { + r0 = rf(name) + } else { + r0 = ret.Get(0).(types.App) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// List provides a mock function with given fields: +func (_m *Apps) List() ([]string, error) { + ret := _m.Called() + + var r0 []string + if rf, ok := ret.Get(0).(func() []string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListDisabled provides a mock function with given fields: +func (_m *Apps) ListDisabled() ([]string, error) { + ret := _m.Called() + + var r0 []string + if rf, ok := ret.Get(0).(func() []string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListEnabled provides a mock function with given fields: +func (_m *Apps) ListEnabled() ([]string, error) { + ret := _m.Called() + + var r0 []string + if rf, ok := ret.Get(0).(func() []string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/types/mocks/AppsConfig.go b/types/mocks/AppsConfig.go new file mode 100644 index 0000000..f099f54 --- /dev/null +++ b/types/mocks/AppsConfig.go @@ -0,0 +1,151 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" + +// AppsConfig is an autogenerated mock type for the AppsConfig type +type AppsConfig struct { + mock.Mock +} + +// DeleteValue provides a mock function with given fields: id, key, value +func (_m *AppsConfig) DeleteValue(id string, key string, value string) error { + ret := _m.Called(id, key, value) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string, string) error); ok { + r0 = rf(id, key, value) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Details provides a mock function with given fields: appID +func (_m *AppsConfig) Details(appID string) (map[string]string, error) { + ret := _m.Called(appID) + + var r0 map[string]string + if rf, ok := ret.Get(0).(func(string) map[string]string); ok { + r0 = rf(appID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(appID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Get provides a mock function with given fields: +func (_m *AppsConfig) Get() (map[string]map[string]string, error) { + ret := _m.Called() + + var r0 map[string]map[string]string + if rf, ok := ret.Get(0).(func() map[string]map[string]string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]map[string]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Keys provides a mock function with given fields: id +func (_m *AppsConfig) Keys(id string) ([]string, error) { + ret := _m.Called(id) + + var r0 []string + if rf, ok := ret.Get(0).(func(string) []string); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// List provides a mock function with given fields: +func (_m *AppsConfig) List() ([]string, error) { + ret := _m.Called() + + var r0 []string + if rf, ok := ret.Get(0).(func() []string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SetValue provides a mock function with given fields: id, key, value +func (_m *AppsConfig) SetValue(id string, key string, value string) error { + ret := _m.Called(id, key, value) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string, string) error); ok { + r0 = rf(id, key, value) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Value provides a mock function with given fields: id, key +func (_m *AppsConfig) Value(id string, key string) (string, error) { + ret := _m.Called(id, key) + + var r0 string + if rf, ok := ret.Get(0).(func(string, string) string); ok { + r0 = rf(id, key) + } else { + r0 = ret.Get(0).(string) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(id, key) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/types/mocks/Auth.go b/types/mocks/Auth.go new file mode 100644 index 0000000..7849773 --- /dev/null +++ b/types/mocks/Auth.go @@ -0,0 +1,38 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" + +// Auth is an autogenerated mock type for the Auth type +type Auth struct { + mock.Mock +} + +// Login provides a mock function with given fields: username, password +func (_m *Auth) Login(username string, password string) error { + ret := _m.Called(username, password) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(username, password) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Logout provides a mock function with given fields: +func (_m *Auth) Logout() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} diff --git a/types/mocks/Client.go b/types/mocks/Client.go new file mode 100644 index 0000000..a047195 --- /dev/null +++ b/types/mocks/Client.go @@ -0,0 +1,44 @@ +package mocks + +import mock "github.com/stretchr/testify/mock" +import types "gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud/types" + +// Client is an autogenerated mock type for the Client type +type Client struct { + mock.Mock +} + +// Apps provides a mock function with given fields: +func (_m *Client) Apps() types.Apps { + return new(Apps) +} + +// AppsConfig provides a mock function with given fields: +func (_m *Client) AppsConfig() types.AppsConfig { + return new(AppsConfig) +} + +// GroupFolders provides a mock function with given fields: +func (_m *Client) GroupFolders() types.GroupFolders { + return new(GroupFolders) +} + +// Groups provides a mock function with given fields: +func (_m *Client) Groups() types.Groups { + return new(Groups) +} + +// Notifications provides a mock function with given fields: +func (_m *Client) Notifications() types.Notifications { + return new(Notifications) +} + +// Shares provides a mock function with given fields: +func (_m *Client) Shares() types.Shares { + return new(Shares) +} + +// Users provides a mock function with given fields: +func (_m *Client) Users() types.Users { + return new(Users) +} diff --git a/types/mocks/GroupFolders.go b/types/mocks/GroupFolders.go new file mode 100644 index 0000000..45241c9 --- /dev/null +++ b/types/mocks/GroupFolders.go @@ -0,0 +1,146 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import types "gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud/types" + +// GroupFolders is an autogenerated mock type for the GroupFolders type +type GroupFolders struct { + mock.Mock +} + +// AddGroup provides a mock function with given fields: folderID, groupName +func (_m *GroupFolders) AddGroup(folderID int, groupName string) error { + ret := _m.Called(folderID, groupName) + + var r0 error + if rf, ok := ret.Get(0).(func(int, string) error); ok { + r0 = rf(folderID, groupName) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Create provides a mock function with given fields: name +func (_m *GroupFolders) Create(name string) (int, error) { + ret := _m.Called(name) + + var r0 int + if rf, ok := ret.Get(0).(func(string) int); ok { + r0 = rf(name) + } else { + r0 = ret.Get(0).(int) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Get provides a mock function with given fields: id +func (_m *GroupFolders) Get(id int) (types.GroupFolder, error) { + ret := _m.Called(id) + + var r0 types.GroupFolder + if rf, ok := ret.Get(0).(func(int) types.GroupFolder); ok { + r0 = rf(id) + } else { + r0 = ret.Get(0).(types.GroupFolder) + } + + var r1 error + if rf, ok := ret.Get(1).(func(int) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// List provides a mock function with given fields: +func (_m *GroupFolders) List() (map[int]types.GroupFolder, error) { + ret := _m.Called() + + var r0 map[int]types.GroupFolder + if rf, ok := ret.Get(0).(func() map[int]types.GroupFolder); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[int]types.GroupFolder) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// RemoveGroup provides a mock function with given fields: folderID, groupName +func (_m *GroupFolders) RemoveGroup(folderID int, groupName string) error { + ret := _m.Called(folderID, groupName) + + var r0 error + if rf, ok := ret.Get(0).(func(int, string) error); ok { + r0 = rf(folderID, groupName) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Rename provides a mock function with given fields: groupID, name +func (_m *GroupFolders) Rename(groupID int, name string) error { + ret := _m.Called(groupID, name) + + var r0 error + if rf, ok := ret.Get(0).(func(int, string) error); ok { + r0 = rf(groupID, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SetGroupPermissions provides a mock function with given fields: folderID, groupName, permission +func (_m *GroupFolders) SetGroupPermissions(folderID int, groupName string, permission types.SharePermission) error { + ret := _m.Called(folderID, groupName, permission) + + var r0 error + if rf, ok := ret.Get(0).(func(int, string, types.SharePermission) error); ok { + r0 = rf(folderID, groupName, permission) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SetQuota provides a mock function with given fields: folderID, quota +func (_m *GroupFolders) SetQuota(folderID int, quota int) error { + ret := _m.Called(folderID, quota) + + var r0 error + if rf, ok := ret.Get(0).(func(int, int) error); ok { + r0 = rf(folderID, quota) + } else { + r0 = ret.Error(0) + } + + return r0 +} diff --git a/types/mocks/Groups.go b/types/mocks/Groups.go new file mode 100644 index 0000000..d656b13 --- /dev/null +++ b/types/mocks/Groups.go @@ -0,0 +1,154 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import types "gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud/types" + +// Groups is an autogenerated mock type for the Groups type +type Groups struct { + mock.Mock +} + +// Create provides a mock function with given fields: name +func (_m *Groups) Create(name string) error { + ret := _m.Called(name) + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Delete provides a mock function with given fields: name +func (_m *Groups) Delete(name string) error { + ret := _m.Called(name) + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// List provides a mock function with given fields: +func (_m *Groups) List() ([]string, error) { + ret := _m.Called() + + var r0 []string + if rf, ok := ret.Get(0).(func() []string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListDetails provides a mock function with given fields: +func (_m *Groups) ListDetails() ([]types.Group, error) { + ret := _m.Called() + + var r0 []types.Group + if rf, ok := ret.Get(0).(func() []types.Group); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.Group) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Search provides a mock function with given fields: search +func (_m *Groups) Search(search string) ([]string, error) { + ret := _m.Called(search) + + var r0 []string + if rf, ok := ret.Get(0).(func(string) []string); ok { + r0 = rf(search) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(search) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SubAdminList provides a mock function with given fields: name +func (_m *Groups) SubAdminList(name string) ([]string, error) { + ret := _m.Called(name) + + var r0 []string + if rf, ok := ret.Get(0).(func(string) []string); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Users provides a mock function with given fields: name +func (_m *Groups) Users(name string) ([]string, error) { + ret := _m.Called(name) + + var r0 []string + if rf, ok := ret.Get(0).(func(string) []string); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/types/mocks/Notifications.go b/types/mocks/Notifications.go new file mode 100644 index 0000000..dca767d --- /dev/null +++ b/types/mocks/Notifications.go @@ -0,0 +1,125 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import types "gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud/types" + +// Notifications is an autogenerated mock type for the Notifications type +type Notifications struct { + mock.Mock +} + +// AdminAvailable provides a mock function with given fields: +func (_m *Notifications) AdminAvailable() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Available provides a mock function with given fields: +func (_m *Notifications) Available() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Create provides a mock function with given fields: userID, title, message +func (_m *Notifications) Create(userID string, title string, message string) error { + ret := _m.Called(userID, title, message) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string, string) error); ok { + r0 = rf(userID, title, message) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Delete provides a mock function with given fields: id +func (_m *Notifications) Delete(id int) error { + ret := _m.Called(id) + + var r0 error + if rf, ok := ret.Get(0).(func(int) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DeleteAll provides a mock function with given fields: +func (_m *Notifications) DeleteAll() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Get provides a mock function with given fields: id +func (_m *Notifications) Get(id int) (types.Notification, error) { + ret := _m.Called(id) + + var r0 types.Notification + if rf, ok := ret.Get(0).(func(int) types.Notification); ok { + r0 = rf(id) + } else { + r0 = ret.Get(0).(types.Notification) + } + + var r1 error + if rf, ok := ret.Get(1).(func(int) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// List provides a mock function with given fields: +func (_m *Notifications) List() ([]types.Notification, error) { + ret := _m.Called() + + var r0 []types.Notification + if rf, ok := ret.Get(0).(func() []types.Notification); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.Notification) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/types/mocks/Shares.go b/types/mocks/Shares.go new file mode 100644 index 0000000..c74ef1e --- /dev/null +++ b/types/mocks/Shares.go @@ -0,0 +1,183 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import types "gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud/types" + +// Shares is an autogenerated mock type for the Shares type +type Shares struct { + mock.Mock +} + +// Create provides a mock function with given fields: path, shareType, permission, shareWith, publicUpload, password +func (_m *Shares) Create(path string, shareType types.ShareType, permission types.SharePermission, shareWith string, publicUpload bool, password string) (types.Share, error) { + ret := _m.Called(path, shareType, permission, shareWith, publicUpload, password) + + var r0 types.Share + if rf, ok := ret.Get(0).(func(string, types.ShareType, types.SharePermission, string, bool, string) types.Share); ok { + r0 = rf(path, shareType, permission, shareWith, publicUpload, password) + } else { + r0 = ret.Get(0).(types.Share) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, types.ShareType, types.SharePermission, string, bool, string) error); ok { + r1 = rf(path, shareType, permission, shareWith, publicUpload, password) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Delete provides a mock function with given fields: shareID +func (_m *Shares) Delete(shareID int) error { + ret := _m.Called(shareID) + + var r0 error + if rf, ok := ret.Get(0).(func(int) error); ok { + r0 = rf(shareID) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Get provides a mock function with given fields: shareID +func (_m *Shares) Get(shareID string) (types.Share, error) { + ret := _m.Called(shareID) + + var r0 types.Share + if rf, ok := ret.Get(0).(func(string) types.Share); ok { + r0 = rf(shareID) + } else { + r0 = ret.Get(0).(types.Share) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(shareID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetFromPath provides a mock function with given fields: path, reshares, subfiles +func (_m *Shares) GetFromPath(path string, reshares bool, subfiles bool) ([]types.Share, error) { + ret := _m.Called(path, reshares, subfiles) + + var r0 []types.Share + if rf, ok := ret.Get(0).(func(string, bool, bool) []types.Share); ok { + r0 = rf(path, reshares, subfiles) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.Share) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, bool, bool) error); ok { + r1 = rf(path, reshares, subfiles) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// List provides a mock function with given fields: +func (_m *Shares) List() ([]types.Share, error) { + ret := _m.Called() + + var r0 []types.Share + if rf, ok := ret.Get(0).(func() []types.Share); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.Share) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Update provides a mock function with given fields: shareUpdate +func (_m *Shares) Update(shareUpdate types.ShareUpdate) error { + ret := _m.Called(shareUpdate) + + var r0 error + if rf, ok := ret.Get(0).(func(types.ShareUpdate) error); ok { + r0 = rf(shareUpdate) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdateExpireDate provides a mock function with given fields: shareID, expireDate +func (_m *Shares) UpdateExpireDate(shareID int, expireDate string) error { + ret := _m.Called(shareID, expireDate) + + var r0 error + if rf, ok := ret.Get(0).(func(int, string) error); ok { + r0 = rf(shareID, expireDate) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdatePassword provides a mock function with given fields: shareID, password +func (_m *Shares) UpdatePassword(shareID int, password string) error { + ret := _m.Called(shareID, password) + + var r0 error + if rf, ok := ret.Get(0).(func(int, string) error); ok { + r0 = rf(shareID, password) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdatePermissions provides a mock function with given fields: shareID, permissions +func (_m *Shares) UpdatePermissions(shareID int, permissions types.SharePermission) error { + ret := _m.Called(shareID, permissions) + + var r0 error + if rf, ok := ret.Get(0).(func(int, types.SharePermission) error); ok { + r0 = rf(shareID, permissions) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdatePublicUpload provides a mock function with given fields: shareID, public +func (_m *Shares) UpdatePublicUpload(shareID int, public bool) error { + ret := _m.Called(shareID, public) + + var r0 error + if rf, ok := ret.Get(0).(func(int, bool) error); ok { + r0 = rf(shareID, public) + } else { + r0 = ret.Error(0) + } + + return r0 +} diff --git a/types/mocks/Users.go b/types/mocks/Users.go new file mode 100644 index 0000000..c6dcbe3 --- /dev/null +++ b/types/mocks/Users.go @@ -0,0 +1,436 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import types "gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud/types" + +// Users is an autogenerated mock type for the Users type +type Users struct { + mock.Mock +} + +// Create provides a mock function with given fields: username, password, user +func (_m *Users) Create(username string, password string, user *types.UserDetails) error { + ret := _m.Called(username, password, user) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string, *types.UserDetails) error); ok { + r0 = rf(username, password, user) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CreateBatchWithoutPassword provides a mock function with given fields: users +func (_m *Users) CreateBatchWithoutPassword(users []types.User) error { + ret := _m.Called(users) + + var r0 error + if rf, ok := ret.Get(0).(func([]types.User) error); ok { + r0 = rf(users) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CreateWithoutPassword provides a mock function with given fields: username, email, displayName, quota, language, groups +func (_m *Users) CreateWithoutPassword(username string, email string, displayName string, quota string, language string, groups ...string) error { + _va := make([]interface{}, len(groups)) + for _i := range groups { + _va[_i] = groups[_i] + } + var _ca []interface{} + _ca = append(_ca, username, email, displayName, quota, language) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string, string, string, string, ...string) error); ok { + r0 = rf(username, email, displayName, quota, language, groups...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Delete provides a mock function with given fields: name +func (_m *Users) Delete(name string) error { + ret := _m.Called(name) + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Disable provides a mock function with given fields: name +func (_m *Users) Disable(name string) error { + ret := _m.Called(name) + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Enable provides a mock function with given fields: name +func (_m *Users) Enable(name string) error { + ret := _m.Called(name) + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Get provides a mock function with given fields: name +func (_m *Users) Get(name string) (*types.UserDetails, error) { + ret := _m.Called(name) + + var r0 *types.UserDetails + if rf, ok := ret.Get(0).(func(string) *types.UserDetails); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.UserDetails) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GroupAdd provides a mock function with given fields: name, group +func (_m *Users) GroupAdd(name string, group string) error { + ret := _m.Called(name, group) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, group) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GroupDemote provides a mock function with given fields: name, group +func (_m *Users) GroupDemote(name string, group string) error { + ret := _m.Called(name, group) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, group) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GroupList provides a mock function with given fields: name +func (_m *Users) GroupList(name string) ([]string, error) { + ret := _m.Called(name) + + var r0 []string + if rf, ok := ret.Get(0).(func(string) []string); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GroupPromote provides a mock function with given fields: name, group +func (_m *Users) GroupPromote(name string, group string) error { + ret := _m.Called(name, group) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, group) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GroupRemove provides a mock function with given fields: name, group +func (_m *Users) GroupRemove(name string, group string) error { + ret := _m.Called(name, group) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, group) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GroupSubAdminList provides a mock function with given fields: name +func (_m *Users) GroupSubAdminList(name string) ([]string, error) { + ret := _m.Called(name) + + var r0 []string + if rf, ok := ret.Get(0).(func(string) []string); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// List provides a mock function with given fields: +func (_m *Users) List() ([]string, error) { + ret := _m.Called() + + var r0 []string + if rf, ok := ret.Get(0).(func() []string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ListDetails provides a mock function with given fields: +func (_m *Users) ListDetails() (map[string]types.UserDetails, error) { + ret := _m.Called() + + var r0 map[string]types.UserDetails + if rf, ok := ret.Get(0).(func() map[string]types.UserDetails); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]types.UserDetails) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Search provides a mock function with given fields: search +func (_m *Users) Search(search string) ([]string, error) { + ret := _m.Called(search) + + var r0 []string + if rf, ok := ret.Get(0).(func(string) []string); ok { + r0 = rf(search) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(search) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SendWelcomeEmail provides a mock function with given fields: name +func (_m *Users) SendWelcomeEmail(name string) error { + ret := _m.Called(name) + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Update provides a mock function with given fields: user +func (_m *Users) Update(user *types.UserDetails) error { + ret := _m.Called(user) + + var r0 error + if rf, ok := ret.Get(0).(func(*types.UserDetails) error); ok { + r0 = rf(user) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdateAddress provides a mock function with given fields: name, address +func (_m *Users) UpdateAddress(name string, address string) error { + ret := _m.Called(name, address) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, address) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdateDisplayName provides a mock function with given fields: name, displayName +func (_m *Users) UpdateDisplayName(name string, displayName string) error { + ret := _m.Called(name, displayName) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, displayName) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdateEmail provides a mock function with given fields: name, email +func (_m *Users) UpdateEmail(name string, email string) error { + ret := _m.Called(name, email) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, email) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdatePassword provides a mock function with given fields: name, password +func (_m *Users) UpdatePassword(name string, password string) error { + ret := _m.Called(name, password) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, password) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdatePhone provides a mock function with given fields: name, phone +func (_m *Users) UpdatePhone(name string, phone string) error { + ret := _m.Called(name, phone) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, phone) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdateQuota provides a mock function with given fields: name, quota +func (_m *Users) UpdateQuota(name string, quota int) error { + ret := _m.Called(name, quota) + + var r0 error + if rf, ok := ret.Get(0).(func(string, int) error); ok { + r0 = rf(name, quota) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdateTwitter provides a mock function with given fields: name, twitter +func (_m *Users) UpdateTwitter(name string, twitter string) error { + ret := _m.Called(name, twitter) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, twitter) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UpdateWebSite provides a mock function with given fields: name, website +func (_m *Users) UpdateWebSite(name string, website string) error { + ret := _m.Called(name, website) + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(name, website) + } else { + r0 = ret.Error(0) + } + + return r0 +}