mock

package
v0.0.0-pre.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchRepoMock

type BatchRepoMock struct {
	// CreateFunc mocks the Create method.
	CreateFunc func(ctx context.Context, batch migration.Batch) (migration.Batch, error)

	// DeleteByNameFunc mocks the DeleteByName method.
	DeleteByNameFunc func(ctx context.Context, name string) error

	// GetAllFunc mocks the GetAll method.
	GetAllFunc func(ctx context.Context) (migration.Batches, error)

	// GetAllByStateFunc mocks the GetAllByState method.
	GetAllByStateFunc func(ctx context.Context, status api.BatchStatusType) (migration.Batches, error)

	// GetAllNamesFunc mocks the GetAllNames method.
	GetAllNamesFunc func(ctx context.Context) ([]string, error)

	// GetByIDFunc mocks the GetByID method.
	GetByIDFunc func(ctx context.Context, id int) (migration.Batch, error)

	// GetByNameFunc mocks the GetByName method.
	GetByNameFunc func(ctx context.Context, name string) (migration.Batch, error)

	// UpdateByIDFunc mocks the UpdateByID method.
	UpdateByIDFunc func(ctx context.Context, batch migration.Batch) (migration.Batch, error)

	// UpdateStatusByIDFunc mocks the UpdateStatusByID method.
	UpdateStatusByIDFunc func(ctx context.Context, id int, status api.BatchStatusType, statusString string) (migration.Batch, error)
	// contains filtered or unexported fields
}

BatchRepoMock is a mock implementation of migration.BatchRepo.

func TestSomethingThatUsesBatchRepo(t *testing.T) {

	// make and configure a mocked migration.BatchRepo
	mockedBatchRepo := &BatchRepoMock{
		CreateFunc: func(ctx context.Context, batch migration.Batch) (migration.Batch, error) {
			panic("mock out the Create method")
		},
		DeleteByNameFunc: func(ctx context.Context, name string) error {
			panic("mock out the DeleteByName method")
		},
		GetAllFunc: func(ctx context.Context) (migration.Batches, error) {
			panic("mock out the GetAll method")
		},
		GetAllByStateFunc: func(ctx context.Context, status api.BatchStatusType) (migration.Batches, error) {
			panic("mock out the GetAllByState method")
		},
		GetAllNamesFunc: func(ctx context.Context) ([]string, error) {
			panic("mock out the GetAllNames method")
		},
		GetByIDFunc: func(ctx context.Context, id int) (migration.Batch, error) {
			panic("mock out the GetByID method")
		},
		GetByNameFunc: func(ctx context.Context, name string) (migration.Batch, error) {
			panic("mock out the GetByName method")
		},
		UpdateByIDFunc: func(ctx context.Context, batch migration.Batch) (migration.Batch, error) {
			panic("mock out the UpdateByID method")
		},
		UpdateStatusByIDFunc: func(ctx context.Context, id int, status api.BatchStatusType, statusString string) (migration.Batch, error) {
			panic("mock out the UpdateStatusByID method")
		},
	}

	// use mockedBatchRepo in code that requires migration.BatchRepo
	// and then make assertions.

}

func (*BatchRepoMock) Create

func (mock *BatchRepoMock) Create(ctx context.Context, batch migration.Batch) (migration.Batch, error)

Create calls CreateFunc.

func (*BatchRepoMock) CreateCalls

func (mock *BatchRepoMock) CreateCalls() []struct {
	Ctx   context.Context
	Batch migration.Batch
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedBatchRepo.CreateCalls())

func (*BatchRepoMock) DeleteByName

func (mock *BatchRepoMock) DeleteByName(ctx context.Context, name string) error

DeleteByName calls DeleteByNameFunc.

func (*BatchRepoMock) DeleteByNameCalls

func (mock *BatchRepoMock) DeleteByNameCalls() []struct {
	Ctx  context.Context
	Name string
}

DeleteByNameCalls gets all the calls that were made to DeleteByName. Check the length with:

len(mockedBatchRepo.DeleteByNameCalls())

func (*BatchRepoMock) GetAll

func (mock *BatchRepoMock) GetAll(ctx context.Context) (migration.Batches, error)

GetAll calls GetAllFunc.

func (*BatchRepoMock) GetAllByState

func (mock *BatchRepoMock) GetAllByState(ctx context.Context, status api.BatchStatusType) (migration.Batches, error)

GetAllByState calls GetAllByStateFunc.

func (*BatchRepoMock) GetAllByStateCalls

func (mock *BatchRepoMock) GetAllByStateCalls() []struct {
	Ctx    context.Context
	Status api.BatchStatusType
}

GetAllByStateCalls gets all the calls that were made to GetAllByState. Check the length with:

len(mockedBatchRepo.GetAllByStateCalls())

func (*BatchRepoMock) GetAllCalls

func (mock *BatchRepoMock) GetAllCalls() []struct {
	Ctx context.Context
}

GetAllCalls gets all the calls that were made to GetAll. Check the length with:

len(mockedBatchRepo.GetAllCalls())

func (*BatchRepoMock) GetAllNames

func (mock *BatchRepoMock) GetAllNames(ctx context.Context) ([]string, error)

GetAllNames calls GetAllNamesFunc.

func (*BatchRepoMock) GetAllNamesCalls

func (mock *BatchRepoMock) GetAllNamesCalls() []struct {
	Ctx context.Context
}

GetAllNamesCalls gets all the calls that were made to GetAllNames. Check the length with:

len(mockedBatchRepo.GetAllNamesCalls())

func (*BatchRepoMock) GetByID

func (mock *BatchRepoMock) GetByID(ctx context.Context, id int) (migration.Batch, error)

GetByID calls GetByIDFunc.

func (*BatchRepoMock) GetByIDCalls

func (mock *BatchRepoMock) GetByIDCalls() []struct {
	Ctx context.Context
	ID  int
}

GetByIDCalls gets all the calls that were made to GetByID. Check the length with:

len(mockedBatchRepo.GetByIDCalls())

func (*BatchRepoMock) GetByName

func (mock *BatchRepoMock) GetByName(ctx context.Context, name string) (migration.Batch, error)

GetByName calls GetByNameFunc.

func (*BatchRepoMock) GetByNameCalls

func (mock *BatchRepoMock) GetByNameCalls() []struct {
	Ctx  context.Context
	Name string
}

GetByNameCalls gets all the calls that were made to GetByName. Check the length with:

len(mockedBatchRepo.GetByNameCalls())

func (*BatchRepoMock) UpdateByID

func (mock *BatchRepoMock) UpdateByID(ctx context.Context, batch migration.Batch) (migration.Batch, error)

UpdateByID calls UpdateByIDFunc.

func (*BatchRepoMock) UpdateByIDCalls

func (mock *BatchRepoMock) UpdateByIDCalls() []struct {
	Ctx   context.Context
	Batch migration.Batch
}

UpdateByIDCalls gets all the calls that were made to UpdateByID. Check the length with:

len(mockedBatchRepo.UpdateByIDCalls())

func (*BatchRepoMock) UpdateStatusByID

func (mock *BatchRepoMock) UpdateStatusByID(ctx context.Context, id int, status api.BatchStatusType, statusString string) (migration.Batch, error)

UpdateStatusByID calls UpdateStatusByIDFunc.

func (*BatchRepoMock) UpdateStatusByIDCalls

func (mock *BatchRepoMock) UpdateStatusByIDCalls() []struct {
	Ctx          context.Context
	ID           int
	Status       api.BatchStatusType
	StatusString string
}

UpdateStatusByIDCalls gets all the calls that were made to UpdateStatusByID. Check the length with:

len(mockedBatchRepo.UpdateStatusByIDCalls())

type InstanceRepoMock

type InstanceRepoMock struct {
	// CreateFunc mocks the Create method.
	CreateFunc func(ctx context.Context, instance migration.Instance) (migration.Instance, error)

	// CreateOverridesFunc mocks the CreateOverrides method.
	CreateOverridesFunc func(ctx context.Context, overrides migration.Overrides) (migration.Overrides, error)

	// DeleteByIDFunc mocks the DeleteByID method.
	DeleteByIDFunc func(ctx context.Context, id uuid.UUID) error

	// DeleteOverridesByIDFunc mocks the DeleteOverridesByID method.
	DeleteOverridesByIDFunc func(ctx context.Context, id uuid.UUID) error

	// GetAllFunc mocks the GetAll method.
	GetAllFunc func(ctx context.Context) (migration.Instances, error)

	// GetAllByBatchIDFunc mocks the GetAllByBatchID method.
	GetAllByBatchIDFunc func(ctx context.Context, batchID int) (migration.Instances, error)

	// GetAllByStateFunc mocks the GetAllByState method.
	GetAllByStateFunc func(ctx context.Context, status api.MigrationStatusType) (migration.Instances, error)

	// GetAllUUIDsFunc mocks the GetAllUUIDs method.
	GetAllUUIDsFunc func(ctx context.Context) ([]uuid.UUID, error)

	// GetAllUnassignedFunc mocks the GetAllUnassigned method.
	GetAllUnassignedFunc func(ctx context.Context) (migration.Instances, error)

	// GetByIDFunc mocks the GetByID method.
	GetByIDFunc func(ctx context.Context, id uuid.UUID) (migration.Instance, error)

	// GetOverridesByIDFunc mocks the GetOverridesByID method.
	GetOverridesByIDFunc func(ctx context.Context, id uuid.UUID) (migration.Overrides, error)

	// UpdateByIDFunc mocks the UpdateByID method.
	UpdateByIDFunc func(ctx context.Context, instance migration.Instance) (migration.Instance, error)

	// UpdateOverridesByIDFunc mocks the UpdateOverridesByID method.
	UpdateOverridesByIDFunc func(ctx context.Context, overrides migration.Overrides) (migration.Overrides, error)

	// UpdateStatusByUUIDFunc mocks the UpdateStatusByUUID method.
	UpdateStatusByUUIDFunc func(ctx context.Context, id uuid.UUID, status api.MigrationStatusType, statusString string, needsDiskImport bool) (migration.Instance, error)
	// contains filtered or unexported fields
}

InstanceRepoMock is a mock implementation of migration.InstanceRepo.

func TestSomethingThatUsesInstanceRepo(t *testing.T) {

	// make and configure a mocked migration.InstanceRepo
	mockedInstanceRepo := &InstanceRepoMock{
		CreateFunc: func(ctx context.Context, instance migration.Instance) (migration.Instance, error) {
			panic("mock out the Create method")
		},
		CreateOverridesFunc: func(ctx context.Context, overrides migration.Overrides) (migration.Overrides, error) {
			panic("mock out the CreateOverrides method")
		},
		DeleteByIDFunc: func(ctx context.Context, id uuid.UUID) error {
			panic("mock out the DeleteByID method")
		},
		DeleteOverridesByIDFunc: func(ctx context.Context, id uuid.UUID) error {
			panic("mock out the DeleteOverridesByID method")
		},
		GetAllFunc: func(ctx context.Context) (migration.Instances, error) {
			panic("mock out the GetAll method")
		},
		GetAllByBatchIDFunc: func(ctx context.Context, batchID int) (migration.Instances, error) {
			panic("mock out the GetAllByBatchID method")
		},
		GetAllByStateFunc: func(ctx context.Context, status api.MigrationStatusType) (migration.Instances, error) {
			panic("mock out the GetAllByState method")
		},
		GetAllUUIDsFunc: func(ctx context.Context) ([]uuid.UUID, error) {
			panic("mock out the GetAllUUIDs method")
		},
		GetAllUnassignedFunc: func(ctx context.Context) (migration.Instances, error) {
			panic("mock out the GetAllUnassigned method")
		},
		GetByIDFunc: func(ctx context.Context, id uuid.UUID) (migration.Instance, error) {
			panic("mock out the GetByID method")
		},
		GetOverridesByIDFunc: func(ctx context.Context, id uuid.UUID) (migration.Overrides, error) {
			panic("mock out the GetOverridesByID method")
		},
		UpdateByIDFunc: func(ctx context.Context, instance migration.Instance) (migration.Instance, error) {
			panic("mock out the UpdateByID method")
		},
		UpdateOverridesByIDFunc: func(ctx context.Context, overrides migration.Overrides) (migration.Overrides, error) {
			panic("mock out the UpdateOverridesByID method")
		},
		UpdateStatusByUUIDFunc: func(ctx context.Context, id uuid.UUID, status api.MigrationStatusType, statusString string, needsDiskImport bool) (migration.Instance, error) {
			panic("mock out the UpdateStatusByUUID method")
		},
	}

	// use mockedInstanceRepo in code that requires migration.InstanceRepo
	// and then make assertions.

}

func (*InstanceRepoMock) Create

func (mock *InstanceRepoMock) Create(ctx context.Context, instance migration.Instance) (migration.Instance, error)

Create calls CreateFunc.

func (*InstanceRepoMock) CreateCalls

func (mock *InstanceRepoMock) CreateCalls() []struct {
	Ctx      context.Context
	Instance migration.Instance
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedInstanceRepo.CreateCalls())

func (*InstanceRepoMock) CreateOverrides

func (mock *InstanceRepoMock) CreateOverrides(ctx context.Context, overrides migration.Overrides) (migration.Overrides, error)

CreateOverrides calls CreateOverridesFunc.

func (*InstanceRepoMock) CreateOverridesCalls

func (mock *InstanceRepoMock) CreateOverridesCalls() []struct {
	Ctx       context.Context
	Overrides migration.Overrides
}

CreateOverridesCalls gets all the calls that were made to CreateOverrides. Check the length with:

len(mockedInstanceRepo.CreateOverridesCalls())

func (*InstanceRepoMock) DeleteByID

func (mock *InstanceRepoMock) DeleteByID(ctx context.Context, id uuid.UUID) error

DeleteByID calls DeleteByIDFunc.

func (*InstanceRepoMock) DeleteByIDCalls

func (mock *InstanceRepoMock) DeleteByIDCalls() []struct {
	Ctx context.Context
	ID  uuid.UUID
}

DeleteByIDCalls gets all the calls that were made to DeleteByID. Check the length with:

len(mockedInstanceRepo.DeleteByIDCalls())

func (*InstanceRepoMock) DeleteOverridesByID

func (mock *InstanceRepoMock) DeleteOverridesByID(ctx context.Context, id uuid.UUID) error

DeleteOverridesByID calls DeleteOverridesByIDFunc.

func (*InstanceRepoMock) DeleteOverridesByIDCalls

func (mock *InstanceRepoMock) DeleteOverridesByIDCalls() []struct {
	Ctx context.Context
	ID  uuid.UUID
}

DeleteOverridesByIDCalls gets all the calls that were made to DeleteOverridesByID. Check the length with:

len(mockedInstanceRepo.DeleteOverridesByIDCalls())

func (*InstanceRepoMock) GetAll

GetAll calls GetAllFunc.

func (*InstanceRepoMock) GetAllByBatchID

func (mock *InstanceRepoMock) GetAllByBatchID(ctx context.Context, batchID int) (migration.Instances, error)

GetAllByBatchID calls GetAllByBatchIDFunc.

func (*InstanceRepoMock) GetAllByBatchIDCalls

func (mock *InstanceRepoMock) GetAllByBatchIDCalls() []struct {
	Ctx     context.Context
	BatchID int
}

GetAllByBatchIDCalls gets all the calls that were made to GetAllByBatchID. Check the length with:

len(mockedInstanceRepo.GetAllByBatchIDCalls())

func (*InstanceRepoMock) GetAllByState

func (mock *InstanceRepoMock) GetAllByState(ctx context.Context, status api.MigrationStatusType) (migration.Instances, error)

GetAllByState calls GetAllByStateFunc.

func (*InstanceRepoMock) GetAllByStateCalls

func (mock *InstanceRepoMock) GetAllByStateCalls() []struct {
	Ctx    context.Context
	Status api.MigrationStatusType
}

GetAllByStateCalls gets all the calls that were made to GetAllByState. Check the length with:

len(mockedInstanceRepo.GetAllByStateCalls())

func (*InstanceRepoMock) GetAllCalls

func (mock *InstanceRepoMock) GetAllCalls() []struct {
	Ctx context.Context
}

GetAllCalls gets all the calls that were made to GetAll. Check the length with:

len(mockedInstanceRepo.GetAllCalls())

func (*InstanceRepoMock) GetAllUUIDs

func (mock *InstanceRepoMock) GetAllUUIDs(ctx context.Context) ([]uuid.UUID, error)

GetAllUUIDs calls GetAllUUIDsFunc.

func (*InstanceRepoMock) GetAllUUIDsCalls

func (mock *InstanceRepoMock) GetAllUUIDsCalls() []struct {
	Ctx context.Context
}

GetAllUUIDsCalls gets all the calls that were made to GetAllUUIDs. Check the length with:

len(mockedInstanceRepo.GetAllUUIDsCalls())

func (*InstanceRepoMock) GetAllUnassigned

func (mock *InstanceRepoMock) GetAllUnassigned(ctx context.Context) (migration.Instances, error)

GetAllUnassigned calls GetAllUnassignedFunc.

func (*InstanceRepoMock) GetAllUnassignedCalls

func (mock *InstanceRepoMock) GetAllUnassignedCalls() []struct {
	Ctx context.Context
}

GetAllUnassignedCalls gets all the calls that were made to GetAllUnassigned. Check the length with:

len(mockedInstanceRepo.GetAllUnassignedCalls())

func (*InstanceRepoMock) GetByID

func (mock *InstanceRepoMock) GetByID(ctx context.Context, id uuid.UUID) (migration.Instance, error)

GetByID calls GetByIDFunc.

func (*InstanceRepoMock) GetByIDCalls

func (mock *InstanceRepoMock) GetByIDCalls() []struct {
	Ctx context.Context
	ID  uuid.UUID
}

GetByIDCalls gets all the calls that were made to GetByID. Check the length with:

len(mockedInstanceRepo.GetByIDCalls())

func (*InstanceRepoMock) GetOverridesByID

func (mock *InstanceRepoMock) GetOverridesByID(ctx context.Context, id uuid.UUID) (migration.Overrides, error)

GetOverridesByID calls GetOverridesByIDFunc.

func (*InstanceRepoMock) GetOverridesByIDCalls

func (mock *InstanceRepoMock) GetOverridesByIDCalls() []struct {
	Ctx context.Context
	ID  uuid.UUID
}

GetOverridesByIDCalls gets all the calls that were made to GetOverridesByID. Check the length with:

len(mockedInstanceRepo.GetOverridesByIDCalls())

func (*InstanceRepoMock) UpdateByID

func (mock *InstanceRepoMock) UpdateByID(ctx context.Context, instance migration.Instance) (migration.Instance, error)

UpdateByID calls UpdateByIDFunc.

func (*InstanceRepoMock) UpdateByIDCalls

func (mock *InstanceRepoMock) UpdateByIDCalls() []struct {
	Ctx      context.Context
	Instance migration.Instance
}

UpdateByIDCalls gets all the calls that were made to UpdateByID. Check the length with:

len(mockedInstanceRepo.UpdateByIDCalls())

func (*InstanceRepoMock) UpdateOverridesByID

func (mock *InstanceRepoMock) UpdateOverridesByID(ctx context.Context, overrides migration.Overrides) (migration.Overrides, error)

UpdateOverridesByID calls UpdateOverridesByIDFunc.

func (*InstanceRepoMock) UpdateOverridesByIDCalls

func (mock *InstanceRepoMock) UpdateOverridesByIDCalls() []struct {
	Ctx       context.Context
	Overrides migration.Overrides
}

UpdateOverridesByIDCalls gets all the calls that were made to UpdateOverridesByID. Check the length with:

len(mockedInstanceRepo.UpdateOverridesByIDCalls())

func (*InstanceRepoMock) UpdateStatusByUUID

func (mock *InstanceRepoMock) UpdateStatusByUUID(ctx context.Context, id uuid.UUID, status api.MigrationStatusType, statusString string, needsDiskImport bool) (migration.Instance, error)

UpdateStatusByUUID calls UpdateStatusByUUIDFunc.

func (*InstanceRepoMock) UpdateStatusByUUIDCalls

func (mock *InstanceRepoMock) UpdateStatusByUUIDCalls() []struct {
	Ctx             context.Context
	ID              uuid.UUID
	Status          api.MigrationStatusType
	StatusString    string
	NeedsDiskImport bool
}

UpdateStatusByUUIDCalls gets all the calls that were made to UpdateStatusByUUID. Check the length with:

len(mockedInstanceRepo.UpdateStatusByUUIDCalls())

type NetworkRepoMock

type NetworkRepoMock struct {
	// CreateFunc mocks the Create method.
	CreateFunc func(ctx context.Context, network migration.Network) (migration.Network, error)

	// DeleteByNameFunc mocks the DeleteByName method.
	DeleteByNameFunc func(ctx context.Context, name string) error

	// GetAllFunc mocks the GetAll method.
	GetAllFunc func(ctx context.Context) (migration.Networks, error)

	// GetAllNamesFunc mocks the GetAllNames method.
	GetAllNamesFunc func(ctx context.Context) ([]string, error)

	// GetByIDFunc mocks the GetByID method.
	GetByIDFunc func(ctx context.Context, id int) (migration.Network, error)

	// GetByNameFunc mocks the GetByName method.
	GetByNameFunc func(ctx context.Context, name string) (migration.Network, error)

	// UpdateByIDFunc mocks the UpdateByID method.
	UpdateByIDFunc func(ctx context.Context, network migration.Network) (migration.Network, error)
	// contains filtered or unexported fields
}

NetworkRepoMock is a mock implementation of migration.NetworkRepo.

func TestSomethingThatUsesNetworkRepo(t *testing.T) {

	// make and configure a mocked migration.NetworkRepo
	mockedNetworkRepo := &NetworkRepoMock{
		CreateFunc: func(ctx context.Context, network migration.Network) (migration.Network, error) {
			panic("mock out the Create method")
		},
		DeleteByNameFunc: func(ctx context.Context, name string) error {
			panic("mock out the DeleteByName method")
		},
		GetAllFunc: func(ctx context.Context) (migration.Networks, error) {
			panic("mock out the GetAll method")
		},
		GetAllNamesFunc: func(ctx context.Context) ([]string, error) {
			panic("mock out the GetAllNames method")
		},
		GetByIDFunc: func(ctx context.Context, id int) (migration.Network, error) {
			panic("mock out the GetByID method")
		},
		GetByNameFunc: func(ctx context.Context, name string) (migration.Network, error) {
			panic("mock out the GetByName method")
		},
		UpdateByIDFunc: func(ctx context.Context, network migration.Network) (migration.Network, error) {
			panic("mock out the UpdateByID method")
		},
	}

	// use mockedNetworkRepo in code that requires migration.NetworkRepo
	// and then make assertions.

}

func (*NetworkRepoMock) Create

func (mock *NetworkRepoMock) Create(ctx context.Context, network migration.Network) (migration.Network, error)

Create calls CreateFunc.

func (*NetworkRepoMock) CreateCalls

func (mock *NetworkRepoMock) CreateCalls() []struct {
	Ctx     context.Context
	Network migration.Network
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedNetworkRepo.CreateCalls())

func (*NetworkRepoMock) DeleteByName

func (mock *NetworkRepoMock) DeleteByName(ctx context.Context, name string) error

DeleteByName calls DeleteByNameFunc.

func (*NetworkRepoMock) DeleteByNameCalls

func (mock *NetworkRepoMock) DeleteByNameCalls() []struct {
	Ctx  context.Context
	Name string
}

DeleteByNameCalls gets all the calls that were made to DeleteByName. Check the length with:

len(mockedNetworkRepo.DeleteByNameCalls())

func (*NetworkRepoMock) GetAll

func (mock *NetworkRepoMock) GetAll(ctx context.Context) (migration.Networks, error)

GetAll calls GetAllFunc.

func (*NetworkRepoMock) GetAllCalls

func (mock *NetworkRepoMock) GetAllCalls() []struct {
	Ctx context.Context
}

GetAllCalls gets all the calls that were made to GetAll. Check the length with:

len(mockedNetworkRepo.GetAllCalls())

func (*NetworkRepoMock) GetAllNames

func (mock *NetworkRepoMock) GetAllNames(ctx context.Context) ([]string, error)

GetAllNames calls GetAllNamesFunc.

func (*NetworkRepoMock) GetAllNamesCalls

func (mock *NetworkRepoMock) GetAllNamesCalls() []struct {
	Ctx context.Context
}

GetAllNamesCalls gets all the calls that were made to GetAllNames. Check the length with:

len(mockedNetworkRepo.GetAllNamesCalls())

func (*NetworkRepoMock) GetByID

func (mock *NetworkRepoMock) GetByID(ctx context.Context, id int) (migration.Network, error)

GetByID calls GetByIDFunc.

func (*NetworkRepoMock) GetByIDCalls

func (mock *NetworkRepoMock) GetByIDCalls() []struct {
	Ctx context.Context
	ID  int
}

GetByIDCalls gets all the calls that were made to GetByID. Check the length with:

len(mockedNetworkRepo.GetByIDCalls())

func (*NetworkRepoMock) GetByName

func (mock *NetworkRepoMock) GetByName(ctx context.Context, name string) (migration.Network, error)

GetByName calls GetByNameFunc.

func (*NetworkRepoMock) GetByNameCalls

func (mock *NetworkRepoMock) GetByNameCalls() []struct {
	Ctx  context.Context
	Name string
}

GetByNameCalls gets all the calls that were made to GetByName. Check the length with:

len(mockedNetworkRepo.GetByNameCalls())

func (*NetworkRepoMock) UpdateByID

func (mock *NetworkRepoMock) UpdateByID(ctx context.Context, network migration.Network) (migration.Network, error)

UpdateByID calls UpdateByIDFunc.

func (*NetworkRepoMock) UpdateByIDCalls

func (mock *NetworkRepoMock) UpdateByIDCalls() []struct {
	Ctx     context.Context
	Network migration.Network
}

UpdateByIDCalls gets all the calls that were made to UpdateByID. Check the length with:

len(mockedNetworkRepo.UpdateByIDCalls())

type SourceRepoMock

type SourceRepoMock struct {
	// CreateFunc mocks the Create method.
	CreateFunc func(ctx context.Context, source migration.Source) (migration.Source, error)

	// DeleteByNameFunc mocks the DeleteByName method.
	DeleteByNameFunc func(ctx context.Context, name string) error

	// GetAllFunc mocks the GetAll method.
	GetAllFunc func(ctx context.Context) (migration.Sources, error)

	// GetAllNamesFunc mocks the GetAllNames method.
	GetAllNamesFunc func(ctx context.Context) ([]string, error)

	// GetByIDFunc mocks the GetByID method.
	GetByIDFunc func(ctx context.Context, id int) (migration.Source, error)

	// GetByNameFunc mocks the GetByName method.
	GetByNameFunc func(ctx context.Context, name string) (migration.Source, error)

	// UpdateByIDFunc mocks the UpdateByID method.
	UpdateByIDFunc func(ctx context.Context, source migration.Source) (migration.Source, error)
	// contains filtered or unexported fields
}

SourceRepoMock is a mock implementation of migration.SourceRepo.

func TestSomethingThatUsesSourceRepo(t *testing.T) {

	// make and configure a mocked migration.SourceRepo
	mockedSourceRepo := &SourceRepoMock{
		CreateFunc: func(ctx context.Context, source migration.Source) (migration.Source, error) {
			panic("mock out the Create method")
		},
		DeleteByNameFunc: func(ctx context.Context, name string) error {
			panic("mock out the DeleteByName method")
		},
		GetAllFunc: func(ctx context.Context) (migration.Sources, error) {
			panic("mock out the GetAll method")
		},
		GetAllNamesFunc: func(ctx context.Context) ([]string, error) {
			panic("mock out the GetAllNames method")
		},
		GetByIDFunc: func(ctx context.Context, id int) (migration.Source, error) {
			panic("mock out the GetByID method")
		},
		GetByNameFunc: func(ctx context.Context, name string) (migration.Source, error) {
			panic("mock out the GetByName method")
		},
		UpdateByIDFunc: func(ctx context.Context, source migration.Source) (migration.Source, error) {
			panic("mock out the UpdateByID method")
		},
	}

	// use mockedSourceRepo in code that requires migration.SourceRepo
	// and then make assertions.

}

func (*SourceRepoMock) Create

func (mock *SourceRepoMock) Create(ctx context.Context, source migration.Source) (migration.Source, error)

Create calls CreateFunc.

func (*SourceRepoMock) CreateCalls

func (mock *SourceRepoMock) CreateCalls() []struct {
	Ctx    context.Context
	Source migration.Source
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedSourceRepo.CreateCalls())

func (*SourceRepoMock) DeleteByName

func (mock *SourceRepoMock) DeleteByName(ctx context.Context, name string) error

DeleteByName calls DeleteByNameFunc.

func (*SourceRepoMock) DeleteByNameCalls

func (mock *SourceRepoMock) DeleteByNameCalls() []struct {
	Ctx  context.Context
	Name string
}

DeleteByNameCalls gets all the calls that were made to DeleteByName. Check the length with:

len(mockedSourceRepo.DeleteByNameCalls())

func (*SourceRepoMock) GetAll

func (mock *SourceRepoMock) GetAll(ctx context.Context) (migration.Sources, error)

GetAll calls GetAllFunc.

func (*SourceRepoMock) GetAllCalls

func (mock *SourceRepoMock) GetAllCalls() []struct {
	Ctx context.Context
}

GetAllCalls gets all the calls that were made to GetAll. Check the length with:

len(mockedSourceRepo.GetAllCalls())

func (*SourceRepoMock) GetAllNames

func (mock *SourceRepoMock) GetAllNames(ctx context.Context) ([]string, error)

GetAllNames calls GetAllNamesFunc.

func (*SourceRepoMock) GetAllNamesCalls

func (mock *SourceRepoMock) GetAllNamesCalls() []struct {
	Ctx context.Context
}

GetAllNamesCalls gets all the calls that were made to GetAllNames. Check the length with:

len(mockedSourceRepo.GetAllNamesCalls())

func (*SourceRepoMock) GetByID

func (mock *SourceRepoMock) GetByID(ctx context.Context, id int) (migration.Source, error)

GetByID calls GetByIDFunc.

func (*SourceRepoMock) GetByIDCalls

func (mock *SourceRepoMock) GetByIDCalls() []struct {
	Ctx context.Context
	ID  int
}

GetByIDCalls gets all the calls that were made to GetByID. Check the length with:

len(mockedSourceRepo.GetByIDCalls())

func (*SourceRepoMock) GetByName

func (mock *SourceRepoMock) GetByName(ctx context.Context, name string) (migration.Source, error)

GetByName calls GetByNameFunc.

func (*SourceRepoMock) GetByNameCalls

func (mock *SourceRepoMock) GetByNameCalls() []struct {
	Ctx  context.Context
	Name string
}

GetByNameCalls gets all the calls that were made to GetByName. Check the length with:

len(mockedSourceRepo.GetByNameCalls())

func (*SourceRepoMock) UpdateByID

func (mock *SourceRepoMock) UpdateByID(ctx context.Context, source migration.Source) (migration.Source, error)

UpdateByID calls UpdateByIDFunc.

func (*SourceRepoMock) UpdateByIDCalls

func (mock *SourceRepoMock) UpdateByIDCalls() []struct {
	Ctx    context.Context
	Source migration.Source
}

UpdateByIDCalls gets all the calls that were made to UpdateByID. Check the length with:

len(mockedSourceRepo.UpdateByIDCalls())

type TargetRepoMock

type TargetRepoMock struct {
	// CreateFunc mocks the Create method.
	CreateFunc func(ctx context.Context, target migration.Target) (migration.Target, error)

	// DeleteByNameFunc mocks the DeleteByName method.
	DeleteByNameFunc func(ctx context.Context, name string) error

	// GetAllFunc mocks the GetAll method.
	GetAllFunc func(ctx context.Context) (migration.Targets, error)

	// GetAllNamesFunc mocks the GetAllNames method.
	GetAllNamesFunc func(ctx context.Context) ([]string, error)

	// GetByIDFunc mocks the GetByID method.
	GetByIDFunc func(ctx context.Context, id int) (migration.Target, error)

	// GetByNameFunc mocks the GetByName method.
	GetByNameFunc func(ctx context.Context, name string) (migration.Target, error)

	// UpdateByIDFunc mocks the UpdateByID method.
	UpdateByIDFunc func(ctx context.Context, target migration.Target) (migration.Target, error)
	// contains filtered or unexported fields
}

TargetRepoMock is a mock implementation of migration.TargetRepo.

func TestSomethingThatUsesTargetRepo(t *testing.T) {

	// make and configure a mocked migration.TargetRepo
	mockedTargetRepo := &TargetRepoMock{
		CreateFunc: func(ctx context.Context, target migration.Target) (migration.Target, error) {
			panic("mock out the Create method")
		},
		DeleteByNameFunc: func(ctx context.Context, name string) error {
			panic("mock out the DeleteByName method")
		},
		GetAllFunc: func(ctx context.Context) (migration.Targets, error) {
			panic("mock out the GetAll method")
		},
		GetAllNamesFunc: func(ctx context.Context) ([]string, error) {
			panic("mock out the GetAllNames method")
		},
		GetByIDFunc: func(ctx context.Context, id int) (migration.Target, error) {
			panic("mock out the GetByID method")
		},
		GetByNameFunc: func(ctx context.Context, name string) (migration.Target, error) {
			panic("mock out the GetByName method")
		},
		UpdateByIDFunc: func(ctx context.Context, target migration.Target) (migration.Target, error) {
			panic("mock out the UpdateByID method")
		},
	}

	// use mockedTargetRepo in code that requires migration.TargetRepo
	// and then make assertions.

}

func (*TargetRepoMock) Create

func (mock *TargetRepoMock) Create(ctx context.Context, target migration.Target) (migration.Target, error)

Create calls CreateFunc.

func (*TargetRepoMock) CreateCalls

func (mock *TargetRepoMock) CreateCalls() []struct {
	Ctx    context.Context
	Target migration.Target
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedTargetRepo.CreateCalls())

func (*TargetRepoMock) DeleteByName

func (mock *TargetRepoMock) DeleteByName(ctx context.Context, name string) error

DeleteByName calls DeleteByNameFunc.

func (*TargetRepoMock) DeleteByNameCalls

func (mock *TargetRepoMock) DeleteByNameCalls() []struct {
	Ctx  context.Context
	Name string
}

DeleteByNameCalls gets all the calls that were made to DeleteByName. Check the length with:

len(mockedTargetRepo.DeleteByNameCalls())

func (*TargetRepoMock) GetAll

func (mock *TargetRepoMock) GetAll(ctx context.Context) (migration.Targets, error)

GetAll calls GetAllFunc.

func (*TargetRepoMock) GetAllCalls

func (mock *TargetRepoMock) GetAllCalls() []struct {
	Ctx context.Context
}

GetAllCalls gets all the calls that were made to GetAll. Check the length with:

len(mockedTargetRepo.GetAllCalls())

func (*TargetRepoMock) GetAllNames

func (mock *TargetRepoMock) GetAllNames(ctx context.Context) ([]string, error)

GetAllNames calls GetAllNamesFunc.

func (*TargetRepoMock) GetAllNamesCalls

func (mock *TargetRepoMock) GetAllNamesCalls() []struct {
	Ctx context.Context
}

GetAllNamesCalls gets all the calls that were made to GetAllNames. Check the length with:

len(mockedTargetRepo.GetAllNamesCalls())

func (*TargetRepoMock) GetByID

func (mock *TargetRepoMock) GetByID(ctx context.Context, id int) (migration.Target, error)

GetByID calls GetByIDFunc.

func (*TargetRepoMock) GetByIDCalls

func (mock *TargetRepoMock) GetByIDCalls() []struct {
	Ctx context.Context
	ID  int
}

GetByIDCalls gets all the calls that were made to GetByID. Check the length with:

len(mockedTargetRepo.GetByIDCalls())

func (*TargetRepoMock) GetByName

func (mock *TargetRepoMock) GetByName(ctx context.Context, name string) (migration.Target, error)

GetByName calls GetByNameFunc.

func (*TargetRepoMock) GetByNameCalls

func (mock *TargetRepoMock) GetByNameCalls() []struct {
	Ctx  context.Context
	Name string
}

GetByNameCalls gets all the calls that were made to GetByName. Check the length with:

len(mockedTargetRepo.GetByNameCalls())

func (*TargetRepoMock) UpdateByID

func (mock *TargetRepoMock) UpdateByID(ctx context.Context, target migration.Target) (migration.Target, error)

UpdateByID calls UpdateByIDFunc.

func (*TargetRepoMock) UpdateByIDCalls

func (mock *TargetRepoMock) UpdateByIDCalls() []struct {
	Ctx    context.Context
	Target migration.Target
}

UpdateByIDCalls gets all the calls that were made to UpdateByID. Check the length with:

len(mockedTargetRepo.UpdateByIDCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL