build: Modify mockery config to work with v3

Maintaining the positioning of the files from v2 to reduce cognitive
load.
Indentation of yaml files now matches `.editorconfig`.
All mock files regenerated.
Added empty `{}` following convention from `mockery init` etc.
Removed directory specification where it would already match.
This commit is contained in:
06kellyjac
2025-06-19 16:25:39 +01:00
parent 0630d4552a
commit 2a3a20693a
42 changed files with 5647 additions and 4010 deletions
+11 -11
View File
@@ -1,13 +1,13 @@
issue-845-fix: True
resolve-type-alias: False
with-expecter: true
disable-version-string: True
# maintain v2 separate mocks dir
dir: "{{.InterfaceDir}}/mocks"
structname: "{{.InterfaceName}}"
filename: "{{.InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
pkgname: mocks
template: testify
packages:
github.com/opencloud-eu/opencloud/pkg/keycloak:
config:
dir: "pkg/backends/keycloak/mocks"
interfaces:
Client:
github.com/opencloud-eu/opencloud/pkg/keycloak:
config:
dir: pkg/backends/keycloak/mocks
interfaces:
Client: {}
@@ -1,16 +1,31 @@
// Code generated by mockery. DO NOT EDIT.
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
package mocks
import (
context "context"
keycloak "github.com/opencloud-eu/opencloud/pkg/keycloak"
libregraph "github.com/opencloud-eu/libre-graph-api-go"
"context"
"github.com/opencloud-eu/libre-graph-api-go"
"github.com/opencloud-eu/opencloud/pkg/keycloak"
mock "github.com/stretchr/testify/mock"
)
// NewClient creates a new instance of Client. 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 NewClient(t interface {
mock.TestingT
Cleanup(func())
}) *Client {
mock := &Client{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Client is an autogenerated mock type for the Client type
type Client struct {
mock.Mock
@@ -24,9 +39,9 @@ func (_m *Client) EXPECT() *Client_Expecter {
return &Client_Expecter{mock: &_m.Mock}
}
// CreateUser provides a mock function with given fields: ctx, realm, user, userActions
func (_m *Client) CreateUser(ctx context.Context, realm string, user *libregraph.User, userActions []keycloak.UserAction) (string, error) {
ret := _m.Called(ctx, realm, user, userActions)
// CreateUser provides a mock function for the type Client
func (_mock *Client) CreateUser(ctx context.Context, realm string, user *libregraph.User, userActions []keycloak.UserAction) (string, error) {
ret := _mock.Called(ctx, realm, user, userActions)
if len(ret) == 0 {
panic("no return value specified for CreateUser")
@@ -34,21 +49,19 @@ func (_m *Client) CreateUser(ctx context.Context, realm string, user *libregraph
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) (string, error)); ok {
return rf(ctx, realm, user, userActions)
if returnFunc, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) (string, error)); ok {
return returnFunc(ctx, realm, user, userActions)
}
if rf, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) string); ok {
r0 = rf(ctx, realm, user, userActions)
if returnFunc, ok := ret.Get(0).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) string); ok {
r0 = returnFunc(ctx, realm, user, userActions)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) error); ok {
r1 = rf(ctx, realm, user, userActions)
if returnFunc, ok := ret.Get(1).(func(context.Context, string, *libregraph.User, []keycloak.UserAction) error); ok {
r1 = returnFunc(ctx, realm, user, userActions)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
@@ -68,24 +81,45 @@ func (_e *Client_Expecter) CreateUser(ctx interface{}, realm interface{}, user i
func (_c *Client_CreateUser_Call) Run(run func(ctx context.Context, realm string, user *libregraph.User, userActions []keycloak.UserAction)) *Client_CreateUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(*libregraph.User), args[3].([]keycloak.UserAction))
var arg0 context.Context
if args[0] != nil {
arg0 = args[0].(context.Context)
}
var arg1 string
if args[1] != nil {
arg1 = args[1].(string)
}
var arg2 *libregraph.User
if args[2] != nil {
arg2 = args[2].(*libregraph.User)
}
var arg3 []keycloak.UserAction
if args[3] != nil {
arg3 = args[3].([]keycloak.UserAction)
}
run(
arg0,
arg1,
arg2,
arg3,
)
})
return _c
}
func (_c *Client_CreateUser_Call) Return(_a0 string, _a1 error) *Client_CreateUser_Call {
_c.Call.Return(_a0, _a1)
func (_c *Client_CreateUser_Call) Return(s string, err error) *Client_CreateUser_Call {
_c.Call.Return(s, err)
return _c
}
func (_c *Client_CreateUser_Call) RunAndReturn(run func(context.Context, string, *libregraph.User, []keycloak.UserAction) (string, error)) *Client_CreateUser_Call {
func (_c *Client_CreateUser_Call) RunAndReturn(run func(ctx context.Context, realm string, user *libregraph.User, userActions []keycloak.UserAction) (string, error)) *Client_CreateUser_Call {
_c.Call.Return(run)
return _c
}
// GetPIIReport provides a mock function with given fields: ctx, realm, username
func (_m *Client) GetPIIReport(ctx context.Context, realm string, username string) (*keycloak.PIIReport, error) {
ret := _m.Called(ctx, realm, username)
// GetPIIReport provides a mock function for the type Client
func (_mock *Client) GetPIIReport(ctx context.Context, realm string, username string) (*keycloak.PIIReport, error) {
ret := _mock.Called(ctx, realm, username)
if len(ret) == 0 {
panic("no return value specified for GetPIIReport")
@@ -93,23 +127,21 @@ func (_m *Client) GetPIIReport(ctx context.Context, realm string, username strin
var r0 *keycloak.PIIReport
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*keycloak.PIIReport, error)); ok {
return rf(ctx, realm, username)
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (*keycloak.PIIReport, error)); ok {
return returnFunc(ctx, realm, username)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *keycloak.PIIReport); ok {
r0 = rf(ctx, realm, username)
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) *keycloak.PIIReport); ok {
r0 = returnFunc(ctx, realm, username)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*keycloak.PIIReport)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, realm, username)
if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = returnFunc(ctx, realm, username)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
@@ -128,24 +160,40 @@ func (_e *Client_Expecter) GetPIIReport(ctx interface{}, realm interface{}, user
func (_c *Client_GetPIIReport_Call) Run(run func(ctx context.Context, realm string, username string)) *Client_GetPIIReport_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
var arg0 context.Context
if args[0] != nil {
arg0 = args[0].(context.Context)
}
var arg1 string
if args[1] != nil {
arg1 = args[1].(string)
}
var arg2 string
if args[2] != nil {
arg2 = args[2].(string)
}
run(
arg0,
arg1,
arg2,
)
})
return _c
}
func (_c *Client_GetPIIReport_Call) Return(_a0 *keycloak.PIIReport, _a1 error) *Client_GetPIIReport_Call {
_c.Call.Return(_a0, _a1)
func (_c *Client_GetPIIReport_Call) Return(pIIReport *keycloak.PIIReport, err error) *Client_GetPIIReport_Call {
_c.Call.Return(pIIReport, err)
return _c
}
func (_c *Client_GetPIIReport_Call) RunAndReturn(run func(context.Context, string, string) (*keycloak.PIIReport, error)) *Client_GetPIIReport_Call {
func (_c *Client_GetPIIReport_Call) RunAndReturn(run func(ctx context.Context, realm string, username string) (*keycloak.PIIReport, error)) *Client_GetPIIReport_Call {
_c.Call.Return(run)
return _c
}
// GetUserByUsername provides a mock function with given fields: ctx, realm, username
func (_m *Client) GetUserByUsername(ctx context.Context, realm string, username string) (*libregraph.User, error) {
ret := _m.Called(ctx, realm, username)
// GetUserByUsername provides a mock function for the type Client
func (_mock *Client) GetUserByUsername(ctx context.Context, realm string, username string) (*libregraph.User, error) {
ret := _mock.Called(ctx, realm, username)
if len(ret) == 0 {
panic("no return value specified for GetUserByUsername")
@@ -153,23 +201,21 @@ func (_m *Client) GetUserByUsername(ctx context.Context, realm string, username
var r0 *libregraph.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*libregraph.User, error)); ok {
return rf(ctx, realm, username)
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (*libregraph.User, error)); ok {
return returnFunc(ctx, realm, username)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) *libregraph.User); ok {
r0 = rf(ctx, realm, username)
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) *libregraph.User); ok {
r0 = returnFunc(ctx, realm, username)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*libregraph.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, realm, username)
if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = returnFunc(ctx, realm, username)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
@@ -188,36 +234,51 @@ func (_e *Client_Expecter) GetUserByUsername(ctx interface{}, realm interface{},
func (_c *Client_GetUserByUsername_Call) Run(run func(ctx context.Context, realm string, username string)) *Client_GetUserByUsername_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
var arg0 context.Context
if args[0] != nil {
arg0 = args[0].(context.Context)
}
var arg1 string
if args[1] != nil {
arg1 = args[1].(string)
}
var arg2 string
if args[2] != nil {
arg2 = args[2].(string)
}
run(
arg0,
arg1,
arg2,
)
})
return _c
}
func (_c *Client_GetUserByUsername_Call) Return(_a0 *libregraph.User, _a1 error) *Client_GetUserByUsername_Call {
_c.Call.Return(_a0, _a1)
func (_c *Client_GetUserByUsername_Call) Return(user *libregraph.User, err error) *Client_GetUserByUsername_Call {
_c.Call.Return(user, err)
return _c
}
func (_c *Client_GetUserByUsername_Call) RunAndReturn(run func(context.Context, string, string) (*libregraph.User, error)) *Client_GetUserByUsername_Call {
func (_c *Client_GetUserByUsername_Call) RunAndReturn(run func(ctx context.Context, realm string, username string) (*libregraph.User, error)) *Client_GetUserByUsername_Call {
_c.Call.Return(run)
return _c
}
// SendActionsMail provides a mock function with given fields: ctx, realm, userID, userActions
func (_m *Client) SendActionsMail(ctx context.Context, realm string, userID string, userActions []keycloak.UserAction) error {
ret := _m.Called(ctx, realm, userID, userActions)
// SendActionsMail provides a mock function for the type Client
func (_mock *Client) SendActionsMail(ctx context.Context, realm string, userID string, userActions []keycloak.UserAction) error {
ret := _mock.Called(ctx, realm, userID, userActions)
if len(ret) == 0 {
panic("no return value specified for SendActionsMail")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, []keycloak.UserAction) error); ok {
r0 = rf(ctx, realm, userID, userActions)
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, []keycloak.UserAction) error); ok {
r0 = returnFunc(ctx, realm, userID, userActions)
} else {
r0 = ret.Error(0)
}
return r0
}
@@ -237,31 +298,38 @@ func (_e *Client_Expecter) SendActionsMail(ctx interface{}, realm interface{}, u
func (_c *Client_SendActionsMail_Call) Run(run func(ctx context.Context, realm string, userID string, userActions []keycloak.UserAction)) *Client_SendActionsMail_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].([]keycloak.UserAction))
var arg0 context.Context
if args[0] != nil {
arg0 = args[0].(context.Context)
}
var arg1 string
if args[1] != nil {
arg1 = args[1].(string)
}
var arg2 string
if args[2] != nil {
arg2 = args[2].(string)
}
var arg3 []keycloak.UserAction
if args[3] != nil {
arg3 = args[3].([]keycloak.UserAction)
}
run(
arg0,
arg1,
arg2,
arg3,
)
})
return _c
}
func (_c *Client_SendActionsMail_Call) Return(_a0 error) *Client_SendActionsMail_Call {
_c.Call.Return(_a0)
func (_c *Client_SendActionsMail_Call) Return(err error) *Client_SendActionsMail_Call {
_c.Call.Return(err)
return _c
}
func (_c *Client_SendActionsMail_Call) RunAndReturn(run func(context.Context, string, string, []keycloak.UserAction) error) *Client_SendActionsMail_Call {
func (_c *Client_SendActionsMail_Call) RunAndReturn(run func(ctx context.Context, realm string, userID string, userActions []keycloak.UserAction) error) *Client_SendActionsMail_Call {
_c.Call.Return(run)
return _c
}
// NewClient creates a new instance of Client. 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 NewClient(t interface {
mock.TestingT
Cleanup(func())
}) *Client {
mock := &Client{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}