mock

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RDSAreaStoreMock added in v0.10.0

type RDSAreaStoreMock struct {
	// BuildTablesFunc mocks the BuildTables method.
	BuildTablesFunc func(ctx context.Context, executionList []string) error

	// CloseFunc mocks the Close method.
	CloseFunc func()

	// GetAncestorsFunc mocks the GetAncestors method.
	GetAncestorsFunc func(areaID string) ([]models.AreasAncestors, error)

	// GetAreaFunc mocks the GetArea method.
	GetAreaFunc func(ctx context.Context, areaId string) (*models.AreasDataResults, error)

	// GetRelationshipsFunc mocks the GetRelationships method.
	GetRelationshipsFunc func(areaCode string, relationshipParameter string) ([]*models.AreaBasicData, error)

	// InitFunc mocks the Init method.
	InitFunc func(ctx context.Context, cfg *config.Config) error

	// PingFunc mocks the Ping method.
	PingFunc func(ctx context.Context) error

	// UpsertAreaFunc mocks the UpsertArea method.
	UpsertAreaFunc func(ctx context.Context, area models.AreaParams) (bool, error)

	// ValidateAreaFunc mocks the ValidateArea method.
	ValidateAreaFunc func(code string) error
	// contains filtered or unexported fields
}

RDSAreaStoreMock is a mock implementation of api.RDSAreaStore.

func TestSomethingThatUsesRDSAreaStore(t *testing.T) {

	// make and configure a mocked api.RDSAreaStore
	mockedRDSAreaStore := &RDSAreaStoreMock{
		BuildTablesFunc: func(ctx context.Context, executionList []string) error {
			panic("mock out the BuildTables method")
		},
		CloseFunc: func()  {
			panic("mock out the Close method")
		},
		GetAncestorsFunc: func(areaID string) ([]models.AreasAncestors, error) {
			panic("mock out the GetAncestors method")
		},
		GetAreaFunc: func(ctx context.Context, areaId string) (*models.AreasDataResults, error) {
			panic("mock out the GetArea method")
		},
		GetRelationshipsFunc: func(areaCode string, relationshipParameter string) ([]*models.AreaBasicData, error) {
			panic("mock out the GetRelationships method")
		},
		InitFunc: func(ctx context.Context, cfg *config.Config) error {
			panic("mock out the Init method")
		},
		PingFunc: func(ctx context.Context) error {
			panic("mock out the Ping method")
		},
		UpsertAreaFunc: func(ctx context.Context, area models.AreaParams) (bool, error) {
			panic("mock out the UpsertArea method")
		},
		ValidateAreaFunc: func(code string) error {
			panic("mock out the ValidateArea method")
		},
	}

	// use mockedRDSAreaStore in code that requires api.RDSAreaStore
	// and then make assertions.

}

func (*RDSAreaStoreMock) BuildTables added in v0.10.0

func (mock *RDSAreaStoreMock) BuildTables(ctx context.Context, executionList []string) error

BuildTables calls BuildTablesFunc.

func (*RDSAreaStoreMock) BuildTablesCalls added in v0.10.0

func (mock *RDSAreaStoreMock) BuildTablesCalls() []struct {
	Ctx           context.Context
	ExecutionList []string
}

BuildTablesCalls gets all the calls that were made to BuildTables. Check the length with:

len(mockedRDSAreaStore.BuildTablesCalls())

func (*RDSAreaStoreMock) Close added in v0.10.0

func (mock *RDSAreaStoreMock) Close()

Close calls CloseFunc.

func (*RDSAreaStoreMock) CloseCalls added in v0.10.0

func (mock *RDSAreaStoreMock) CloseCalls() []struct {
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedRDSAreaStore.CloseCalls())

func (*RDSAreaStoreMock) GetAncestors added in v0.12.0

func (mock *RDSAreaStoreMock) GetAncestors(areaID string) ([]models.AreasAncestors, error)

GetAncestors calls GetAncestorsFunc.

func (*RDSAreaStoreMock) GetAncestorsCalls added in v0.12.0

func (mock *RDSAreaStoreMock) GetAncestorsCalls() []struct {
	AreaID string
}

GetAncestorsCalls gets all the calls that were made to GetAncestors. Check the length with:

len(mockedRDSAreaStore.GetAncestorsCalls())

func (*RDSAreaStoreMock) GetArea added in v0.10.0

func (mock *RDSAreaStoreMock) GetArea(ctx context.Context, areaId string) (*models.AreasDataResults, error)

GetArea calls GetAreaFunc.

func (*RDSAreaStoreMock) GetAreaCalls added in v0.10.0

func (mock *RDSAreaStoreMock) GetAreaCalls() []struct {
	Ctx    context.Context
	AreaId string
}

GetAreaCalls gets all the calls that were made to GetArea. Check the length with:

len(mockedRDSAreaStore.GetAreaCalls())

func (*RDSAreaStoreMock) GetRelationships added in v0.10.0

func (mock *RDSAreaStoreMock) GetRelationships(areaCode string, relationshipParameter string) ([]*models.AreaBasicData, error)

GetRelationships calls GetRelationshipsFunc.

func (*RDSAreaStoreMock) GetRelationshipsCalls added in v0.10.0

func (mock *RDSAreaStoreMock) GetRelationshipsCalls() []struct {
	AreaCode              string
	RelationshipParameter string
}

GetRelationshipsCalls gets all the calls that were made to GetRelationships. Check the length with:

len(mockedRDSAreaStore.GetRelationshipsCalls())

func (*RDSAreaStoreMock) Init added in v0.10.0

func (mock *RDSAreaStoreMock) Init(ctx context.Context, cfg *config.Config) error

Init calls InitFunc.

func (*RDSAreaStoreMock) InitCalls added in v0.10.0

func (mock *RDSAreaStoreMock) InitCalls() []struct {
	Ctx context.Context
	Cfg *config.Config
}

InitCalls gets all the calls that were made to Init. Check the length with:

len(mockedRDSAreaStore.InitCalls())

func (*RDSAreaStoreMock) Ping added in v0.11.0

func (mock *RDSAreaStoreMock) Ping(ctx context.Context) error

Ping calls PingFunc.

func (*RDSAreaStoreMock) PingCalls added in v0.11.0

func (mock *RDSAreaStoreMock) PingCalls() []struct {
	Ctx context.Context
}

PingCalls gets all the calls that were made to Ping. Check the length with:

len(mockedRDSAreaStore.PingCalls())

func (*RDSAreaStoreMock) UpsertArea added in v0.11.0

func (mock *RDSAreaStoreMock) UpsertArea(ctx context.Context, area models.AreaParams) (bool, error)

UpsertArea calls UpsertAreaFunc.

func (*RDSAreaStoreMock) UpsertAreaCalls added in v0.11.0

func (mock *RDSAreaStoreMock) UpsertAreaCalls() []struct {
	Ctx  context.Context
	Area models.AreaParams
}

UpsertAreaCalls gets all the calls that were made to UpsertArea. Check the length with:

len(mockedRDSAreaStore.UpsertAreaCalls())

func (*RDSAreaStoreMock) ValidateArea added in v0.10.0

func (mock *RDSAreaStoreMock) ValidateArea(code string) error

ValidateArea calls ValidateAreaFunc.

func (*RDSAreaStoreMock) ValidateAreaCalls added in v0.10.0

func (mock *RDSAreaStoreMock) ValidateAreaCalls() []struct {
	Code string
}

ValidateAreaCalls gets all the calls that were made to ValidateArea. Check the length with:

len(mockedRDSAreaStore.ValidateAreaCalls())

Jump to

Keyboard shortcuts

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