Skip to content
Snippets Groups Projects
Commit cec566bb authored by Andre Sterba's avatar Andre Sterba Committed by Fabian Seidl
Browse files

Add mock generation to Makefile and update mocks

See merge request !350
parent 22ec2f5e
Branches
Tags
2 merge requests!350Add mock generation to Makefile and update mocks,!333WIP: Develop
Pipeline #109422 passed
This commit is part of merge request !333. Comments created here will be created in the context of that merge request.
Showing
with 1146 additions and 38 deletions
...@@ -16,6 +16,7 @@ install-tools: ...@@ -16,6 +16,7 @@ install-tools:
mkdir -p $(GOSDN_PRG) mkdir -p $(GOSDN_PRG)
go install gotest.tools/gotestsum@v1.7.0 go install gotest.tools/gotestsum@v1.7.0
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.1 go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.1
go install github.com/vektra/mockery/v2@v2.14.0
@echo Finished installing development tooling @echo Finished installing development tooling
ci-install-tools: ci-install-tools:
...@@ -59,3 +60,6 @@ integration-test-api: ...@@ -59,3 +60,6 @@ integration-test-api:
ENVIRONMENT=testing &&\ ENVIRONMENT=testing &&\
cd ./api &&\ cd ./api &&\
go test -race -v -run TestApiIntegration go test -race -v -run TestApiIntegration
generate-mocks: install-tools
./$(TOOLS_DIR)/mockery --all --dir "./interfaces/"
// Code generated by mockery v2.11.0. DO NOT EDIT. // Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks package mocks
import ( import (
testing "testing" time "time"
pnd "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" pnd "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
time "time"
uuid "github.com/google/uuid" uuid "github.com/google/uuid"
ygot "github.com/openconfig/ygot/ygot" ygot "github.com/openconfig/ygot/ygot"
...@@ -124,9 +122,15 @@ func (_m *Change) State() pnd.ChangeState { ...@@ -124,9 +122,15 @@ func (_m *Change) State() pnd.ChangeState {
return r0 return r0
} }
// NewChange creates a new instance of Change. It also registers a cleanup function to assert the mocks expectations. type mockConstructorTestingTNewChange interface {
func NewChange(t testing.TB) *Change { mock.TestingT
Cleanup(func())
}
// NewChange creates a new instance of Change. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewChange(t mockConstructorTestingTNewChange) *Change {
mock := &Change{} mock := &Change{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) }) t.Cleanup(func() { mock.AssertExpectations(t) })
......
// Code generated by mockery v2.11.0. DO NOT EDIT. // Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks package mocks
...@@ -7,8 +7,6 @@ import ( ...@@ -7,8 +7,6 @@ import (
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
testing "testing"
transport "code.fbi.h-da.de/danet/gosdn/controller/interfaces/transport" transport "code.fbi.h-da.de/danet/gosdn/controller/interfaces/transport"
uuid "github.com/google/uuid" uuid "github.com/google/uuid"
...@@ -60,6 +58,27 @@ func (_m *Device) GetModel() ygot.GoStruct { ...@@ -60,6 +58,27 @@ func (_m *Device) GetModel() ygot.GoStruct {
return r0 return r0
} }
// GetModelAsString provides a mock function with given fields:
func (_m *Device) GetModelAsString() (string, error) {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
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
}
// ID provides a mock function with given fields: // ID provides a mock function with given fields:
func (_m *Device) ID() uuid.UUID { func (_m *Device) ID() uuid.UUID {
ret := _m.Called() ret := _m.Called()
...@@ -150,9 +169,15 @@ func (_m *Device) Transport() transport.Transport { ...@@ -150,9 +169,15 @@ func (_m *Device) Transport() transport.Transport {
return r0 return r0
} }
// NewDevice creates a new instance of Device. It also registers a cleanup function to assert the mocks expectations. type mockConstructorTestingTNewDevice interface {
func NewDevice(t testing.TB) *Device { mock.TestingT
Cleanup(func())
}
// NewDevice creates a new instance of Device. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewDevice(t mockConstructorTestingTNewDevice) *Device {
mock := &Device{} mock := &Device{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) }) t.Cleanup(func() { mock.AssertExpectations(t) })
......
// Code generated by mockery v2.11.0. DO NOT EDIT. // Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks package mocks
...@@ -14,8 +14,6 @@ import ( ...@@ -14,8 +14,6 @@ import (
southbound "code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound" southbound "code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound"
testing "testing"
transport "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport" transport "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
uuid "github.com/google/uuid" uuid "github.com/google/uuid"
...@@ -405,9 +403,15 @@ func (_m *NetworkDomain) RequestAll(_a0 string) error { ...@@ -405,9 +403,15 @@ func (_m *NetworkDomain) RequestAll(_a0 string) error {
return r0 return r0
} }
// NewNetworkDomain creates a new instance of NetworkDomain. It also registers a cleanup function to assert the mocks expectations. type mockConstructorTestingTNewNetworkDomain interface {
func NewNetworkDomain(t testing.TB) *NetworkDomain { mock.TestingT
Cleanup(func())
}
// NewNetworkDomain creates a new instance of NetworkDomain. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewNetworkDomain(t mockConstructorTestingTNewNetworkDomain) *NetworkDomain {
mock := &NetworkDomain{} mock := &NetworkDomain{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) }) t.Cleanup(func() { mock.AssertExpectations(t) })
......
// Code generated by mockery v2.11.0. DO NOT EDIT. // Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks package mocks
import ( import (
testing "testing"
plugin "code.fbi.h-da.de/danet/gosdn/controller/interfaces/plugin" plugin "code.fbi.h-da.de/danet/gosdn/controller/interfaces/plugin"
mock "github.com/stretchr/testify/mock"
uuid "github.com/google/uuid" uuid "github.com/google/uuid"
mock "github.com/stretchr/testify/mock"
) )
// Plugin is an autogenerated mock type for the Plugin type // Plugin is an autogenerated mock type for the Plugin type
...@@ -90,9 +87,15 @@ func (_m *Plugin) Update() error { ...@@ -90,9 +87,15 @@ func (_m *Plugin) Update() error {
return r0 return r0
} }
// NewPlugin creates a new instance of Plugin. It also registers a cleanup function to assert the mocks expectations. type mockConstructorTestingTNewPlugin interface {
func NewPlugin(t testing.TB) *Plugin { mock.TestingT
Cleanup(func())
}
// NewPlugin creates a new instance of Plugin. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewPlugin(t mockConstructorTestingTNewPlugin) *Plugin {
mock := &Plugin{} mock := &Plugin{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) }) t.Cleanup(func() { mock.AssertExpectations(t) })
......
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
device "code.fbi.h-da.de/danet/gosdn/controller/interfaces/device"
mock "github.com/stretchr/testify/mock"
networkdomain "code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkdomain"
store "code.fbi.h-da.de/danet/gosdn/controller/store"
uuid "github.com/google/uuid"
)
// PndStore is an autogenerated mock type for the PndStore type
type PndStore struct {
mock.Mock
}
// Add provides a mock function with given fields: _a0
func (_m *PndStore) Add(_a0 networkdomain.NetworkDomain) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(networkdomain.NetworkDomain) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// AddPendingChannel provides a mock function with given fields: id, ch
func (_m *PndStore) AddPendingChannel(id uuid.UUID, ch chan device.Details) {
_m.Called(id, ch)
}
// Delete provides a mock function with given fields: _a0
func (_m *PndStore) Delete(_a0 networkdomain.NetworkDomain) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(networkdomain.NetworkDomain) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: _a0
func (_m *PndStore) Get(_a0 store.Query) (networkdomain.NetworkDomain, error) {
ret := _m.Called(_a0)
var r0 networkdomain.NetworkDomain
if rf, ok := ret.Get(0).(func(store.Query) networkdomain.NetworkDomain); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(networkdomain.NetworkDomain)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(store.Query) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAll provides a mock function with given fields:
func (_m *PndStore) GetAll() ([]networkdomain.NetworkDomain, error) {
ret := _m.Called()
var r0 []networkdomain.NetworkDomain
if rf, ok := ret.Get(0).(func() []networkdomain.NetworkDomain); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]networkdomain.NetworkDomain)
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PendingChannels provides a mock function with given fields: id, parseErrors
func (_m *PndStore) PendingChannels(id uuid.UUID, parseErrors ...error) (chan device.Details, error) {
_va := make([]interface{}, len(parseErrors))
for _i := range parseErrors {
_va[_i] = parseErrors[_i]
}
var _ca []interface{}
_ca = append(_ca, id)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 chan device.Details
if rf, ok := ret.Get(0).(func(uuid.UUID, ...error) chan device.Details); ok {
r0 = rf(id, parseErrors...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(chan device.Details)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(uuid.UUID, ...error) error); ok {
r1 = rf(id, parseErrors...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RemovePendingChannel provides a mock function with given fields: id
func (_m *PndStore) RemovePendingChannel(id uuid.UUID) {
_m.Called(id)
}
type mockConstructorTestingTNewPndStore interface {
mock.TestingT
Cleanup(func())
}
// NewPndStore creates a new instance of PndStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewPndStore(t mockConstructorTestingTNewPndStore) *PndStore {
mock := &PndStore{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
uuid "github.com/google/uuid"
)
// Role is an autogenerated mock type for the Role type
type Role struct {
mock.Mock
}
// GetDescription provides a mock function with given fields:
func (_m *Role) GetDescription() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetPermissions provides a mock function with given fields:
func (_m *Role) GetPermissions() []string {
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)
}
}
return r0
}
// ID provides a mock function with given fields:
func (_m *Role) ID() uuid.UUID {
ret := _m.Called()
var r0 uuid.UUID
if rf, ok := ret.Get(0).(func() uuid.UUID); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(uuid.UUID)
}
}
return r0
}
// Name provides a mock function with given fields:
func (_m *Role) Name() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// RemovePermissionsFromRole provides a mock function with given fields: _a0
func (_m *Role) RemovePermissionsFromRole(_a0 []string) {
_m.Called(_a0)
}
type mockConstructorTestingTNewRole interface {
mock.TestingT
Cleanup(func())
}
// NewRole creates a new instance of Role. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRole(t mockConstructorTestingTNewRole) *Role {
mock := &Role{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
rbac "code.fbi.h-da.de/danet/gosdn/controller/interfaces/rbac"
store "code.fbi.h-da.de/danet/gosdn/controller/store"
mock "github.com/stretchr/testify/mock"
)
// RoleService is an autogenerated mock type for the RoleService type
type RoleService struct {
mock.Mock
}
// Add provides a mock function with given fields: _a0
func (_m *RoleService) Add(_a0 rbac.Role) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.Role) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Delete provides a mock function with given fields: _a0
func (_m *RoleService) Delete(_a0 rbac.Role) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.Role) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: _a0
func (_m *RoleService) Get(_a0 store.Query) (rbac.Role, error) {
ret := _m.Called(_a0)
var r0 rbac.Role
if rf, ok := ret.Get(0).(func(store.Query) rbac.Role); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(rbac.Role)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(store.Query) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAll provides a mock function with given fields:
func (_m *RoleService) GetAll() ([]rbac.Role, error) {
ret := _m.Called()
var r0 []rbac.Role
if rf, ok := ret.Get(0).(func() []rbac.Role); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]rbac.Role)
}
}
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: _a0
func (_m *RoleService) Update(_a0 rbac.Role) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.Role) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewRoleService interface {
mock.TestingT
Cleanup(func())
}
// NewRoleService creates a new instance of RoleService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRoleService(t mockConstructorTestingTNewRoleService) *RoleService {
mock := &RoleService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
rbac "code.fbi.h-da.de/danet/gosdn/controller/interfaces/rbac"
store "code.fbi.h-da.de/danet/gosdn/controller/store"
mock "github.com/stretchr/testify/mock"
)
// RoleStore is an autogenerated mock type for the RoleStore type
type RoleStore struct {
mock.Mock
}
// Add provides a mock function with given fields: r
func (_m *RoleStore) Add(r rbac.Role) error {
ret := _m.Called(r)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.Role) error); ok {
r0 = rf(r)
} else {
r0 = ret.Error(0)
}
return r0
}
// Delete provides a mock function with given fields: _a0
func (_m *RoleStore) Delete(_a0 rbac.Role) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.Role) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: _a0
func (_m *RoleStore) Get(_a0 store.Query) (rbac.LoadedRole, error) {
ret := _m.Called(_a0)
var r0 rbac.LoadedRole
if rf, ok := ret.Get(0).(func(store.Query) rbac.LoadedRole); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(rbac.LoadedRole)
}
var r1 error
if rf, ok := ret.Get(1).(func(store.Query) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAll provides a mock function with given fields:
func (_m *RoleStore) GetAll() ([]rbac.LoadedRole, error) {
ret := _m.Called()
var r0 []rbac.LoadedRole
if rf, ok := ret.Get(0).(func() []rbac.LoadedRole); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]rbac.LoadedRole)
}
}
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: r
func (_m *RoleStore) Update(r rbac.Role) error {
ret := _m.Called(r)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.Role) error); ok {
r0 = rf(r)
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewRoleStore interface {
mock.TestingT
Cleanup(func())
}
// NewRoleStore creates a new instance of RoleStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewRoleStore(t mockConstructorTestingTNewRoleStore) *RoleStore {
mock := &RoleStore{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
device "code.fbi.h-da.de/danet/gosdn/controller/interfaces/device"
mock "github.com/stretchr/testify/mock"
store "code.fbi.h-da.de/danet/gosdn/controller/store"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
// Add provides a mock function with given fields: _a0
func (_m *Service) Add(_a0 device.Device) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(device.Device) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Delete provides a mock function with given fields: _a0
func (_m *Service) Delete(_a0 device.Device) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(device.Device) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: _a0
func (_m *Service) Get(_a0 store.Query) (device.Device, error) {
ret := _m.Called(_a0)
var r0 device.Device
if rf, ok := ret.Get(0).(func(store.Query) device.Device); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(device.Device)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(store.Query) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAll provides a mock function with given fields:
func (_m *Service) GetAll() ([]device.Device, error) {
ret := _m.Called()
var r0 []device.Device
if rf, ok := ret.Get(0).(func() []device.Device); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]device.Device)
}
}
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: _a0
func (_m *Service) Update(_a0 device.Device) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(device.Device) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewService interface {
mock.TestingT
Cleanup(func())
}
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewService(t mockConstructorTestingTNewService) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Code generated by mockery v2.11.0. DO NOT EDIT. // Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks package mocks
...@@ -7,8 +7,6 @@ import ( ...@@ -7,8 +7,6 @@ import (
gnmi "github.com/openconfig/gnmi/proto/gnmi" gnmi "github.com/openconfig/gnmi/proto/gnmi"
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
testing "testing"
uuid "github.com/google/uuid" uuid "github.com/google/uuid"
yang "github.com/openconfig/goyang/pkg/yang" yang "github.com/openconfig/goyang/pkg/yang"
...@@ -146,9 +144,15 @@ func (_m *SouthboundInterface) Unmarshal(_a0 []byte, _a1 *gnmi.Path, _a2 ygot.Go ...@@ -146,9 +144,15 @@ func (_m *SouthboundInterface) Unmarshal(_a0 []byte, _a1 *gnmi.Path, _a2 ygot.Go
return r0 return r0
} }
// NewSouthboundInterface creates a new instance of SouthboundInterface. It also registers a cleanup function to assert the mocks expectations. type mockConstructorTestingTNewSouthboundInterface interface {
func NewSouthboundInterface(t testing.TB) *SouthboundInterface { mock.TestingT
Cleanup(func())
}
// NewSouthboundInterface creates a new instance of SouthboundInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewSouthboundInterface(t mockConstructorTestingTNewSouthboundInterface) *SouthboundInterface {
mock := &SouthboundInterface{} mock := &SouthboundInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) }) t.Cleanup(func() { mock.AssertExpectations(t) })
......
// Code generated by mockery v2.11.0. DO NOT EDIT. // Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks package mocks
import ( import (
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
testing "testing"
uuid "github.com/google/uuid" uuid "github.com/google/uuid"
) )
...@@ -31,9 +29,15 @@ func (_m *Storable) ID() uuid.UUID { ...@@ -31,9 +29,15 @@ func (_m *Storable) ID() uuid.UUID {
return r0 return r0
} }
// NewStorable creates a new instance of Storable. It also registers a cleanup function to assert the mocks expectations. type mockConstructorTestingTNewStorable interface {
func NewStorable(t testing.TB) *Storable { mock.TestingT
Cleanup(func())
}
// NewStorable creates a new instance of Storable. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewStorable(t mockConstructorTestingTNewStorable) *Storable {
mock := &Storable{} mock := &Storable{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) }) t.Cleanup(func() { mock.AssertExpectations(t) })
......
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
store "code.fbi.h-da.de/danet/gosdn/controller/interfaces/store"
uuid "github.com/google/uuid"
mock "github.com/stretchr/testify/mock"
)
// Store is an autogenerated mock type for the Store type
type Store struct {
mock.Mock
}
// Add provides a mock function with given fields: item
func (_m *Store) Add(item store.Storable) error {
ret := _m.Called(item)
var r0 error
if rf, ok := ret.Get(0).(func(store.Storable) error); ok {
r0 = rf(item)
} else {
r0 = ret.Error(0)
}
return r0
}
// Delete provides a mock function with given fields: id
func (_m *Store) Delete(id uuid.UUID) error {
ret := _m.Called(id)
var r0 error
if rf, ok := ret.Get(0).(func(uuid.UUID) error); ok {
r0 = rf(id)
} else {
r0 = ret.Error(0)
}
return r0
}
// Exists provides a mock function with given fields: id
func (_m *Store) Exists(id uuid.UUID) bool {
ret := _m.Called(id)
var r0 bool
if rf, ok := ret.Get(0).(func(uuid.UUID) bool); ok {
r0 = rf(id)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Get provides a mock function with given fields: id
func (_m *Store) Get(id uuid.UUID) (store.Storable, error) {
ret := _m.Called(id)
var r0 store.Storable
if rf, ok := ret.Get(0).(func(uuid.UUID) store.Storable); ok {
r0 = rf(id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(store.Storable)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(uuid.UUID) error); ok {
r1 = rf(id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UUIDs provides a mock function with given fields:
func (_m *Store) UUIDs() []uuid.UUID {
ret := _m.Called()
var r0 []uuid.UUID
if rf, ok := ret.Get(0).(func() []uuid.UUID); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]uuid.UUID)
}
}
return r0
}
type mockConstructorTestingTNewStore interface {
mock.TestingT
Cleanup(func())
}
// NewStore creates a new instance of Store. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewStore(t mockConstructorTestingTNewStore) *Store {
mock := &Store{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Code generated by mockery v2.11.0. DO NOT EDIT. // Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks package mocks
...@@ -9,8 +9,6 @@ import ( ...@@ -9,8 +9,6 @@ import (
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
testing "testing"
ytypes "github.com/openconfig/ygot/ytypes" ytypes "github.com/openconfig/ygot/ytypes"
) )
...@@ -112,9 +110,15 @@ func (_m *Transport) Type() string { ...@@ -112,9 +110,15 @@ func (_m *Transport) Type() string {
return r0 return r0
} }
// NewTransport creates a new instance of Transport. It also registers a cleanup function to assert the mocks expectations. type mockConstructorTestingTNewTransport interface {
func NewTransport(t testing.TB) *Transport { mock.TestingT
Cleanup(func())
}
// NewTransport creates a new instance of Transport. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewTransport(t mockConstructorTestingTNewTransport) *Transport {
mock := &Transport{} mock := &Transport{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) }) t.Cleanup(func() { mock.AssertExpectations(t) })
......
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
mock "github.com/stretchr/testify/mock"
uuid "github.com/google/uuid"
)
// User is an autogenerated mock type for the User type
type User struct {
mock.Mock
}
// GetPassword provides a mock function with given fields:
func (_m *User) GetPassword() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetRoles provides a mock function with given fields:
func (_m *User) GetRoles() map[string]string {
ret := _m.Called()
var r0 map[string]string
if rf, ok := ret.Get(0).(func() map[string]string); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string]string)
}
}
return r0
}
// GetSalt provides a mock function with given fields:
func (_m *User) GetSalt() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetToken provides a mock function with given fields:
func (_m *User) GetToken() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// ID provides a mock function with given fields:
func (_m *User) ID() uuid.UUID {
ret := _m.Called()
var r0 uuid.UUID
if rf, ok := ret.Get(0).(func() uuid.UUID); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(uuid.UUID)
}
}
return r0
}
// Name provides a mock function with given fields:
func (_m *User) Name() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// SetToken provides a mock function with given fields: _a0
func (_m *User) SetToken(_a0 string) {
_m.Called(_a0)
}
type mockConstructorTestingTNewUser interface {
mock.TestingT
Cleanup(func())
}
// NewUser creates a new instance of User. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewUser(t mockConstructorTestingTNewUser) *User {
mock := &User{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
rbac "code.fbi.h-da.de/danet/gosdn/controller/interfaces/rbac"
store "code.fbi.h-da.de/danet/gosdn/controller/store"
mock "github.com/stretchr/testify/mock"
)
// UserService is an autogenerated mock type for the UserService type
type UserService struct {
mock.Mock
}
// Add provides a mock function with given fields: _a0
func (_m *UserService) Add(_a0 rbac.User) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.User) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Delete provides a mock function with given fields: _a0
func (_m *UserService) Delete(_a0 rbac.User) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.User) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: _a0
func (_m *UserService) Get(_a0 store.Query) (rbac.User, error) {
ret := _m.Called(_a0)
var r0 rbac.User
if rf, ok := ret.Get(0).(func(store.Query) rbac.User); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(rbac.User)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(store.Query) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAll provides a mock function with given fields:
func (_m *UserService) GetAll() ([]rbac.User, error) {
ret := _m.Called()
var r0 []rbac.User
if rf, ok := ret.Get(0).(func() []rbac.User); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]rbac.User)
}
}
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: _a0
func (_m *UserService) Update(_a0 rbac.User) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.User) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewUserService interface {
mock.TestingT
Cleanup(func())
}
// NewUserService creates a new instance of UserService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewUserService(t mockConstructorTestingTNewUserService) *UserService {
mock := &UserService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
rbac "code.fbi.h-da.de/danet/gosdn/controller/interfaces/rbac"
store "code.fbi.h-da.de/danet/gosdn/controller/store"
mock "github.com/stretchr/testify/mock"
)
// UserStore is an autogenerated mock type for the UserStore type
type UserStore struct {
mock.Mock
}
// Add provides a mock function with given fields: u
func (_m *UserStore) Add(u rbac.User) error {
ret := _m.Called(u)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.User) error); ok {
r0 = rf(u)
} else {
r0 = ret.Error(0)
}
return r0
}
// Delete provides a mock function with given fields: _a0
func (_m *UserStore) Delete(_a0 rbac.User) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.User) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Get provides a mock function with given fields: _a0
func (_m *UserStore) Get(_a0 store.Query) (rbac.LoadedUser, error) {
ret := _m.Called(_a0)
var r0 rbac.LoadedUser
if rf, ok := ret.Get(0).(func(store.Query) rbac.LoadedUser); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(rbac.LoadedUser)
}
var r1 error
if rf, ok := ret.Get(1).(func(store.Query) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAll provides a mock function with given fields:
func (_m *UserStore) GetAll() ([]rbac.LoadedUser, error) {
ret := _m.Called()
var r0 []rbac.LoadedUser
if rf, ok := ret.Get(0).(func() []rbac.LoadedUser); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]rbac.LoadedUser)
}
}
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: u
func (_m *UserStore) Update(u rbac.User) error {
ret := _m.Called(u)
var r0 error
if rf, ok := ret.Get(0).(func(rbac.User) error); ok {
r0 = rf(u)
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewUserStore interface {
mock.TestingT
Cleanup(func())
}
// NewUserStore creates a new instance of UserStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewUserStore(t mockConstructorTestingTNewUserStore) *UserStore {
mock := &UserStore{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment