mock

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CantabularClientMock added in v1.1.0

type CantabularClientMock struct {
	// CheckQueryCountFunc mocks the CheckQueryCount method.
	CheckQueryCountFunc func(contextMoqParam context.Context, staticDatasetQueryRequest cantabular.StaticDatasetQueryRequest) (int, error)

	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error

	// CheckerAPIExtFunc mocks the CheckerAPIExt method.
	CheckerAPIExtFunc func(ctx context.Context, state *healthcheck.CheckState) error

	// GetAreaFunc mocks the GetArea method.
	GetAreaFunc func(contextMoqParam context.Context, getAreaRequest cantabular.GetAreaRequest) (*cantabular.GetAreaResponse, error)

	// GetAreasFunc mocks the GetAreas method.
	GetAreasFunc func(contextMoqParam context.Context, getAreasRequest cantabular.GetAreasRequest) (*cantabular.GetAreasResponse, error)

	// GetAreasTotalCountFunc mocks the GetAreasTotalCount method.
	GetAreasTotalCountFunc func(contextMoqParam context.Context, getAreasRequest cantabular.GetAreasRequest) (int, error)

	// GetBaseVariableFunc mocks the GetBaseVariable method.
	GetBaseVariableFunc func(contextMoqParam context.Context, getBaseVariableRequest cantabular.GetBaseVariableRequest) (*cantabular.GetBaseVariableResponse, error)

	// GetBlockedAreaCountFunc mocks the GetBlockedAreaCount method.
	GetBlockedAreaCountFunc func(ctx context.Context, req cantabular.GetBlockedAreaCountRequest) (*cantabular.GetBlockedAreaCountResult, error)

	// GetCategorisationsFunc mocks the GetCategorisations method.
	GetCategorisationsFunc func(contextMoqParam context.Context, getCategorisationsRequest cantabular.GetCategorisationsRequest) (*cantabular.GetCategorisationsResponse, error)

	// GetDimensionCategoriesFunc mocks the GetDimensionCategories method.
	GetDimensionCategoriesFunc func(contextMoqParam context.Context, getDimensionCategoriesRequest cantabular.GetDimensionCategoriesRequest) (*cantabular.GetDimensionCategoriesResponse, error)

	// GetDimensionsFunc mocks the GetDimensions method.
	GetDimensionsFunc func(contextMoqParam context.Context, getDimensionsRequest cantabular.GetDimensionsRequest) (*cantabular.GetDimensionsResponse, error)

	// GetDimensionsDescriptionFunc mocks the GetDimensionsDescription method.
	GetDimensionsDescriptionFunc func(contextMoqParam context.Context, getDimensionsDescriptionRequest cantabular.GetDimensionsDescriptionRequest) (*cantabular.GetDimensionsResponse, error)

	// GetGeographyDimensionsFunc mocks the GetGeographyDimensions method.
	GetGeographyDimensionsFunc func(ctx context.Context, req cantabular.GetGeographyDimensionsRequest) (*cantabular.GetGeographyDimensionsResponse, error)

	// GetParentAreaCountFunc mocks the GetParentAreaCount method.
	GetParentAreaCountFunc func(ctx context.Context, req cantabular.GetParentAreaCountRequest) (*cantabular.GetParentAreaCountResult, error)

	// GetParentsFunc mocks the GetParents method.
	GetParentsFunc func(contextMoqParam context.Context, getParentsRequest cantabular.GetParentsRequest) (*cantabular.GetParentsResponse, error)

	// ListDatasetsFunc mocks the ListDatasets method.
	ListDatasetsFunc func(contextMoqParam context.Context) (*cantabular.ListDatasetsResponse, error)

	// StaticDatasetQueryFunc mocks the StaticDatasetQuery method.
	StaticDatasetQueryFunc func(contextMoqParam context.Context, staticDatasetQueryRequest cantabular.StaticDatasetQueryRequest) (*cantabular.StaticDatasetQuery, error)

	// StaticDatasetQueryStreamJSONFunc mocks the StaticDatasetQueryStreamJSON method.
	StaticDatasetQueryStreamJSONFunc func(contextMoqParam context.Context, staticDatasetQueryRequest cantabular.StaticDatasetQueryRequest, fn func(ctx context.Context, r io.Reader) error) (cantabular.GetObservationsResponse, error)

	// StaticDatasetTypeFunc mocks the StaticDatasetType method.
	StaticDatasetTypeFunc func(ctx context.Context, datasetName string) (*gql.Dataset, error)

	// StatusCodeFunc mocks the StatusCode method.
	StatusCodeFunc func(err error) int
	// contains filtered or unexported fields
}

CantabularClientMock is a mock implementation of service.CantabularClient.

func TestSomethingThatUsesCantabularClient(t *testing.T) {

	// make and configure a mocked service.CantabularClient
	mockedCantabularClient := &CantabularClientMock{
		CheckQueryCountFunc: func(contextMoqParam context.Context, staticDatasetQueryRequest cantabular.StaticDatasetQueryRequest) (int, error) {
			panic("mock out the CheckQueryCount method")
		},
		CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		CheckerAPIExtFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the CheckerAPIExt method")
		},
		GetAreaFunc: func(contextMoqParam context.Context, getAreaRequest cantabular.GetAreaRequest) (*cantabular.GetAreaResponse, error) {
			panic("mock out the GetArea method")
		},
		GetAreasFunc: func(contextMoqParam context.Context, getAreasRequest cantabular.GetAreasRequest) (*cantabular.GetAreasResponse, error) {
			panic("mock out the GetAreas method")
		},
		GetAreasTotalCountFunc: func(contextMoqParam context.Context, getAreasRequest cantabular.GetAreasRequest) (int, error) {
			panic("mock out the GetAreasTotalCount method")
		},
		GetBaseVariableFunc: func(contextMoqParam context.Context, getBaseVariableRequest cantabular.GetBaseVariableRequest) (*cantabular.GetBaseVariableResponse, error) {
			panic("mock out the GetBaseVariable method")
		},
		GetBlockedAreaCountFunc: func(ctx context.Context, req cantabular.GetBlockedAreaCountRequest) (*cantabular.GetBlockedAreaCountResult, error) {
			panic("mock out the GetBlockedAreaCount method")
		},
		GetCategorisationsFunc: func(contextMoqParam context.Context, getCategorisationsRequest cantabular.GetCategorisationsRequest) (*cantabular.GetCategorisationsResponse, error) {
			panic("mock out the GetCategorisations method")
		},
		GetDimensionCategoriesFunc: func(contextMoqParam context.Context, getDimensionCategoriesRequest cantabular.GetDimensionCategoriesRequest) (*cantabular.GetDimensionCategoriesResponse, error) {
			panic("mock out the GetDimensionCategories method")
		},
		GetDimensionsFunc: func(contextMoqParam context.Context, getDimensionsRequest cantabular.GetDimensionsRequest) (*cantabular.GetDimensionsResponse, error) {
			panic("mock out the GetDimensions method")
		},
		GetDimensionsDescriptionFunc: func(contextMoqParam context.Context, getDimensionsDescriptionRequest cantabular.GetDimensionsDescriptionRequest) (*cantabular.GetDimensionsResponse, error) {
			panic("mock out the GetDimensionsDescription method")
		},
		GetGeographyDimensionsFunc: func(ctx context.Context, req cantabular.GetGeographyDimensionsRequest) (*cantabular.GetGeographyDimensionsResponse, error) {
			panic("mock out the GetGeographyDimensions method")
		},
		GetParentAreaCountFunc: func(ctx context.Context, req cantabular.GetParentAreaCountRequest) (*cantabular.GetParentAreaCountResult, error) {
			panic("mock out the GetParentAreaCount method")
		},
		GetParentsFunc: func(contextMoqParam context.Context, getParentsRequest cantabular.GetParentsRequest) (*cantabular.GetParentsResponse, error) {
			panic("mock out the GetParents method")
		},
		ListDatasetsFunc: func(contextMoqParam context.Context) (*cantabular.ListDatasetsResponse, error) {
			panic("mock out the ListDatasets method")
		},
		StaticDatasetQueryFunc: func(contextMoqParam context.Context, staticDatasetQueryRequest cantabular.StaticDatasetQueryRequest) (*cantabular.StaticDatasetQuery, error) {
			panic("mock out the StaticDatasetQuery method")
		},
		StaticDatasetQueryStreamJSONFunc: func(contextMoqParam context.Context, staticDatasetQueryRequest cantabular.StaticDatasetQueryRequest, fn func(ctx context.Context, r io.Reader) error) (cantabular.GetObservationsResponse, error) {
			panic("mock out the StaticDatasetQueryStreamJSON method")
		},
		StaticDatasetTypeFunc: func(ctx context.Context, datasetName string) (*gql.Dataset, error) {
			panic("mock out the StaticDatasetType method")
		},
		StatusCodeFunc: func(err error) int {
			panic("mock out the StatusCode method")
		},
	}

	// use mockedCantabularClient in code that requires service.CantabularClient
	// and then make assertions.

}

func (*CantabularClientMock) CheckQueryCount added in v1.31.0

func (mock *CantabularClientMock) CheckQueryCount(contextMoqParam context.Context, staticDatasetQueryRequest cantabular.StaticDatasetQueryRequest) (int, error)

CheckQueryCount calls CheckQueryCountFunc.

func (*CantabularClientMock) CheckQueryCountCalls added in v1.31.0

func (mock *CantabularClientMock) CheckQueryCountCalls() []struct {
	ContextMoqParam           context.Context
	StaticDatasetQueryRequest cantabular.StaticDatasetQueryRequest
}

CheckQueryCountCalls gets all the calls that were made to CheckQueryCount. Check the length with:

len(mockedCantabularClient.CheckQueryCountCalls())

func (*CantabularClientMock) Checker added in v1.1.0

func (mock *CantabularClientMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*CantabularClientMock) CheckerAPIExt added in v1.10.0

func (mock *CantabularClientMock) CheckerAPIExt(ctx context.Context, state *healthcheck.CheckState) error

CheckerAPIExt calls CheckerAPIExtFunc.

func (*CantabularClientMock) CheckerAPIExtCalls added in v1.10.0

func (mock *CantabularClientMock) CheckerAPIExtCalls() []struct {
	Ctx   context.Context
	State *healthcheck.CheckState
}

CheckerAPIExtCalls gets all the calls that were made to CheckerAPIExt. Check the length with:

len(mockedCantabularClient.CheckerAPIExtCalls())

func (*CantabularClientMock) CheckerCalls added in v1.1.0

func (mock *CantabularClientMock) CheckerCalls() []struct {
	Ctx   context.Context
	State *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedCantabularClient.CheckerCalls())

func (*CantabularClientMock) GetArea added in v1.9.0

func (mock *CantabularClientMock) GetArea(contextMoqParam context.Context, getAreaRequest cantabular.GetAreaRequest) (*cantabular.GetAreaResponse, error)

GetArea calls GetAreaFunc.

func (*CantabularClientMock) GetAreaCalls added in v1.9.0

func (mock *CantabularClientMock) GetAreaCalls() []struct {
	ContextMoqParam context.Context
	GetAreaRequest  cantabular.GetAreaRequest
}

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

len(mockedCantabularClient.GetAreaCalls())

func (*CantabularClientMock) GetAreas added in v1.2.0

func (mock *CantabularClientMock) GetAreas(contextMoqParam context.Context, getAreasRequest cantabular.GetAreasRequest) (*cantabular.GetAreasResponse, error)

GetAreas calls GetAreasFunc.

func (*CantabularClientMock) GetAreasCalls added in v1.2.0

func (mock *CantabularClientMock) GetAreasCalls() []struct {
	ContextMoqParam context.Context
	GetAreasRequest cantabular.GetAreasRequest
}

GetAreasCalls gets all the calls that were made to GetAreas. Check the length with:

len(mockedCantabularClient.GetAreasCalls())

func (*CantabularClientMock) GetAreasTotalCount added in v1.18.0

func (mock *CantabularClientMock) GetAreasTotalCount(contextMoqParam context.Context, getAreasRequest cantabular.GetAreasRequest) (int, error)

GetAreasTotalCount calls GetAreasTotalCountFunc.

func (*CantabularClientMock) GetAreasTotalCountCalls added in v1.18.0

func (mock *CantabularClientMock) GetAreasTotalCountCalls() []struct {
	ContextMoqParam context.Context
	GetAreasRequest cantabular.GetAreasRequest
}

GetAreasTotalCountCalls gets all the calls that were made to GetAreasTotalCount. Check the length with:

len(mockedCantabularClient.GetAreasTotalCountCalls())

func (*CantabularClientMock) GetBaseVariable added in v1.13.0

func (mock *CantabularClientMock) GetBaseVariable(contextMoqParam context.Context, getBaseVariableRequest cantabular.GetBaseVariableRequest) (*cantabular.GetBaseVariableResponse, error)

GetBaseVariable calls GetBaseVariableFunc.

func (*CantabularClientMock) GetBaseVariableCalls added in v1.13.0

func (mock *CantabularClientMock) GetBaseVariableCalls() []struct {
	ContextMoqParam        context.Context
	GetBaseVariableRequest cantabular.GetBaseVariableRequest
}

GetBaseVariableCalls gets all the calls that were made to GetBaseVariable. Check the length with:

len(mockedCantabularClient.GetBaseVariableCalls())

func (*CantabularClientMock) GetBlockedAreaCount added in v1.22.0

GetBlockedAreaCount calls GetBlockedAreaCountFunc.

func (*CantabularClientMock) GetBlockedAreaCountCalls added in v1.22.0

func (mock *CantabularClientMock) GetBlockedAreaCountCalls() []struct {
	Ctx context.Context
	Req cantabular.GetBlockedAreaCountRequest
}

GetBlockedAreaCountCalls gets all the calls that were made to GetBlockedAreaCount. Check the length with:

len(mockedCantabularClient.GetBlockedAreaCountCalls())

func (*CantabularClientMock) GetCategorisations added in v1.9.0

func (mock *CantabularClientMock) GetCategorisations(contextMoqParam context.Context, getCategorisationsRequest cantabular.GetCategorisationsRequest) (*cantabular.GetCategorisationsResponse, error)

GetCategorisations calls GetCategorisationsFunc.

func (*CantabularClientMock) GetCategorisationsCalls added in v1.9.0

func (mock *CantabularClientMock) GetCategorisationsCalls() []struct {
	ContextMoqParam           context.Context
	GetCategorisationsRequest cantabular.GetCategorisationsRequest
}

GetCategorisationsCalls gets all the calls that were made to GetCategorisations. Check the length with:

len(mockedCantabularClient.GetCategorisationsCalls())

func (*CantabularClientMock) GetDimensionCategories added in v1.21.0

func (mock *CantabularClientMock) GetDimensionCategories(contextMoqParam context.Context, getDimensionCategoriesRequest cantabular.GetDimensionCategoriesRequest) (*cantabular.GetDimensionCategoriesResponse, error)

GetDimensionCategories calls GetDimensionCategoriesFunc.

func (*CantabularClientMock) GetDimensionCategoriesCalls added in v1.21.0

func (mock *CantabularClientMock) GetDimensionCategoriesCalls() []struct {
	ContextMoqParam               context.Context
	GetDimensionCategoriesRequest cantabular.GetDimensionCategoriesRequest
}

GetDimensionCategoriesCalls gets all the calls that were made to GetDimensionCategories. Check the length with:

len(mockedCantabularClient.GetDimensionCategoriesCalls())

func (*CantabularClientMock) GetDimensions added in v1.8.0

func (mock *CantabularClientMock) GetDimensions(contextMoqParam context.Context, getDimensionsRequest cantabular.GetDimensionsRequest) (*cantabular.GetDimensionsResponse, error)

GetDimensions calls GetDimensionsFunc.

func (*CantabularClientMock) GetDimensionsCalls added in v1.8.0

func (mock *CantabularClientMock) GetDimensionsCalls() []struct {
	ContextMoqParam      context.Context
	GetDimensionsRequest cantabular.GetDimensionsRequest
}

GetDimensionsCalls gets all the calls that were made to GetDimensions. Check the length with:

len(mockedCantabularClient.GetDimensionsCalls())

func (*CantabularClientMock) GetDimensionsDescription added in v1.21.0

func (mock *CantabularClientMock) GetDimensionsDescription(contextMoqParam context.Context, getDimensionsDescriptionRequest cantabular.GetDimensionsDescriptionRequest) (*cantabular.GetDimensionsResponse, error)

GetDimensionsDescription calls GetDimensionsDescriptionFunc.

func (*CantabularClientMock) GetDimensionsDescriptionCalls added in v1.21.0

func (mock *CantabularClientMock) GetDimensionsDescriptionCalls() []struct {
	ContextMoqParam                 context.Context
	GetDimensionsDescriptionRequest cantabular.GetDimensionsDescriptionRequest
}

GetDimensionsDescriptionCalls gets all the calls that were made to GetDimensionsDescription. Check the length with:

len(mockedCantabularClient.GetDimensionsDescriptionCalls())

func (*CantabularClientMock) GetGeographyDimensions added in v1.2.0

GetGeographyDimensions calls GetGeographyDimensionsFunc.

func (*CantabularClientMock) GetGeographyDimensionsCalls added in v1.2.0

func (mock *CantabularClientMock) GetGeographyDimensionsCalls() []struct {
	Ctx context.Context
	Req cantabular.GetGeographyDimensionsRequest
}

GetGeographyDimensionsCalls gets all the calls that were made to GetGeographyDimensions. Check the length with:

len(mockedCantabularClient.GetGeographyDimensionsCalls())

func (*CantabularClientMock) GetParentAreaCount added in v1.11.0

GetParentAreaCount calls GetParentAreaCountFunc.

func (*CantabularClientMock) GetParentAreaCountCalls added in v1.11.0

func (mock *CantabularClientMock) GetParentAreaCountCalls() []struct {
	Ctx context.Context
	Req cantabular.GetParentAreaCountRequest
}

GetParentAreaCountCalls gets all the calls that were made to GetParentAreaCount. Check the length with:

len(mockedCantabularClient.GetParentAreaCountCalls())

func (*CantabularClientMock) GetParents added in v1.3.2

func (mock *CantabularClientMock) GetParents(contextMoqParam context.Context, getParentsRequest cantabular.GetParentsRequest) (*cantabular.GetParentsResponse, error)

GetParents calls GetParentsFunc.

func (*CantabularClientMock) GetParentsCalls added in v1.3.2

func (mock *CantabularClientMock) GetParentsCalls() []struct {
	ContextMoqParam   context.Context
	GetParentsRequest cantabular.GetParentsRequest
}

GetParentsCalls gets all the calls that were made to GetParents. Check the length with:

len(mockedCantabularClient.GetParentsCalls())

func (*CantabularClientMock) ListDatasets added in v1.1.0

func (mock *CantabularClientMock) ListDatasets(contextMoqParam context.Context) (*cantabular.ListDatasetsResponse, error)

ListDatasets calls ListDatasetsFunc.

func (*CantabularClientMock) ListDatasetsCalls added in v1.1.0

func (mock *CantabularClientMock) ListDatasetsCalls() []struct {
	ContextMoqParam context.Context
}

ListDatasetsCalls gets all the calls that were made to ListDatasets. Check the length with:

len(mockedCantabularClient.ListDatasetsCalls())

func (*CantabularClientMock) StaticDatasetQuery added in v1.25.0

func (mock *CantabularClientMock) StaticDatasetQuery(contextMoqParam context.Context, staticDatasetQueryRequest cantabular.StaticDatasetQueryRequest) (*cantabular.StaticDatasetQuery, error)

StaticDatasetQuery calls StaticDatasetQueryFunc.

func (*CantabularClientMock) StaticDatasetQueryCalls added in v1.25.0

func (mock *CantabularClientMock) StaticDatasetQueryCalls() []struct {
	ContextMoqParam           context.Context
	StaticDatasetQueryRequest cantabular.StaticDatasetQueryRequest
}

StaticDatasetQueryCalls gets all the calls that were made to StaticDatasetQuery. Check the length with:

len(mockedCantabularClient.StaticDatasetQueryCalls())

func (*CantabularClientMock) StaticDatasetQueryStreamJSON added in v1.32.0

func (mock *CantabularClientMock) StaticDatasetQueryStreamJSON(contextMoqParam context.Context, staticDatasetQueryRequest cantabular.StaticDatasetQueryRequest, fn func(ctx context.Context, r io.Reader) error) (cantabular.GetObservationsResponse, error)

StaticDatasetQueryStreamJSON calls StaticDatasetQueryStreamJSONFunc.

func (*CantabularClientMock) StaticDatasetQueryStreamJSONCalls added in v1.32.0

func (mock *CantabularClientMock) StaticDatasetQueryStreamJSONCalls() []struct {
	ContextMoqParam           context.Context
	StaticDatasetQueryRequest cantabular.StaticDatasetQueryRequest
	Fn                        func(ctx context.Context, r io.Reader) error
}

StaticDatasetQueryStreamJSONCalls gets all the calls that were made to StaticDatasetQueryStreamJSON. Check the length with:

len(mockedCantabularClient.StaticDatasetQueryStreamJSONCalls())

func (*CantabularClientMock) StaticDatasetType added in v1.26.0

func (mock *CantabularClientMock) StaticDatasetType(ctx context.Context, datasetName string) (*gql.Dataset, error)

StaticDatasetType calls StaticDatasetTypeFunc.

func (*CantabularClientMock) StaticDatasetTypeCalls added in v1.26.0

func (mock *CantabularClientMock) StaticDatasetTypeCalls() []struct {
	Ctx         context.Context
	DatasetName string
}

StaticDatasetTypeCalls gets all the calls that were made to StaticDatasetType. Check the length with:

len(mockedCantabularClient.StaticDatasetTypeCalls())

func (*CantabularClientMock) StatusCode added in v1.2.0

func (mock *CantabularClientMock) StatusCode(err error) int

StatusCode calls StatusCodeFunc.

func (*CantabularClientMock) StatusCodeCalls added in v1.2.0

func (mock *CantabularClientMock) StatusCodeCalls() []struct {
	Err error
}

StatusCodeCalls gets all the calls that were made to StatusCode. Check the length with:

len(mockedCantabularClient.StatusCodeCalls())

type DatasetAPIClientMock added in v1.2.0

type DatasetAPIClientMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error

	// GetDatasetsFunc mocks the GetDatasets method.
	GetDatasetsFunc func(ctx context.Context, uToken string, svcToken string, collectionID string, params *dataset.QueryParams) (dataset.List, error)
	// contains filtered or unexported fields
}

DatasetAPIClientMock is a mock implementation of service.DatasetAPIClient.

func TestSomethingThatUsesDatasetAPIClient(t *testing.T) {

	// make and configure a mocked service.DatasetAPIClient
	mockedDatasetAPIClient := &DatasetAPIClientMock{
		CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		GetDatasetsFunc: func(ctx context.Context, uToken string, svcToken string, collectionID string, params *dataset.QueryParams) (dataset.List, error) {
			panic("mock out the GetDatasets method")
		},
	}

	// use mockedDatasetAPIClient in code that requires service.DatasetAPIClient
	// and then make assertions.

}

func (*DatasetAPIClientMock) Checker added in v1.2.0

func (mock *DatasetAPIClientMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*DatasetAPIClientMock) CheckerCalls added in v1.2.0

func (mock *DatasetAPIClientMock) CheckerCalls() []struct {
	Ctx   context.Context
	State *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedDatasetAPIClient.CheckerCalls())

func (*DatasetAPIClientMock) GetDatasets added in v1.2.0

func (mock *DatasetAPIClientMock) GetDatasets(ctx context.Context, uToken string, svcToken string, collectionID string, params *dataset.QueryParams) (dataset.List, error)

GetDatasets calls GetDatasetsFunc.

func (*DatasetAPIClientMock) GetDatasetsCalls added in v1.2.0

func (mock *DatasetAPIClientMock) GetDatasetsCalls() []struct {
	Ctx          context.Context
	UToken       string
	SvcToken     string
	CollectionID string
	Params       *dataset.QueryParams
}

GetDatasetsCalls gets all the calls that were made to GetDatasets. Check the length with:

len(mockedDatasetAPIClient.GetDatasetsCalls())

type HTTPServerMock

type HTTPServerMock struct {
	// ListenAndServeFunc mocks the ListenAndServe method.
	ListenAndServeFunc func() error

	// ShutdownFunc mocks the Shutdown method.
	ShutdownFunc func(ctx context.Context) error
	// contains filtered or unexported fields
}

HTTPServerMock is a mock implementation of service.HTTPServer.

func TestSomethingThatUsesHTTPServer(t *testing.T) {

	// make and configure a mocked service.HTTPServer
	mockedHTTPServer := &HTTPServerMock{
		ListenAndServeFunc: func() error {
			panic("mock out the ListenAndServe method")
		},
		ShutdownFunc: func(ctx context.Context) error {
			panic("mock out the Shutdown method")
		},
	}

	// use mockedHTTPServer in code that requires service.HTTPServer
	// and then make assertions.

}

func (*HTTPServerMock) ListenAndServe

func (mock *HTTPServerMock) ListenAndServe() error

ListenAndServe calls ListenAndServeFunc.

func (*HTTPServerMock) ListenAndServeCalls

func (mock *HTTPServerMock) ListenAndServeCalls() []struct {
}

ListenAndServeCalls gets all the calls that were made to ListenAndServe. Check the length with:

len(mockedHTTPServer.ListenAndServeCalls())

func (*HTTPServerMock) Shutdown

func (mock *HTTPServerMock) Shutdown(ctx context.Context) error

Shutdown calls ShutdownFunc.

func (*HTTPServerMock) ShutdownCalls

func (mock *HTTPServerMock) ShutdownCalls() []struct {
	Ctx context.Context
}

ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:

len(mockedHTTPServer.ShutdownCalls())

type HealthCheckerMock

type HealthCheckerMock struct {
	// AddCheckFunc mocks the AddCheck method.
	AddCheckFunc func(name string, checker healthcheck.Checker) error

	// HandlerFunc mocks the Handler method.
	HandlerFunc func(w http.ResponseWriter, req *http.Request)

	// StartFunc mocks the Start method.
	StartFunc func(ctx context.Context)

	// StopFunc mocks the Stop method.
	StopFunc func()
	// contains filtered or unexported fields
}

HealthCheckerMock is a mock implementation of service.HealthChecker.

func TestSomethingThatUsesHealthChecker(t *testing.T) {

	// make and configure a mocked service.HealthChecker
	mockedHealthChecker := &HealthCheckerMock{
		AddCheckFunc: func(name string, checker healthcheck.Checker) error {
			panic("mock out the AddCheck method")
		},
		HandlerFunc: func(w http.ResponseWriter, req *http.Request)  {
			panic("mock out the Handler method")
		},
		StartFunc: func(ctx context.Context)  {
			panic("mock out the Start method")
		},
		StopFunc: func()  {
			panic("mock out the Stop method")
		},
	}

	// use mockedHealthChecker in code that requires service.HealthChecker
	// and then make assertions.

}

func (*HealthCheckerMock) AddCheck

func (mock *HealthCheckerMock) AddCheck(name string, checker healthcheck.Checker) error

AddCheck calls AddCheckFunc.

func (*HealthCheckerMock) AddCheckCalls

func (mock *HealthCheckerMock) AddCheckCalls() []struct {
	Name    string
	Checker healthcheck.Checker
}

AddCheckCalls gets all the calls that were made to AddCheck. Check the length with:

len(mockedHealthChecker.AddCheckCalls())

func (*HealthCheckerMock) Handler

func (mock *HealthCheckerMock) Handler(w http.ResponseWriter, req *http.Request)

Handler calls HandlerFunc.

func (*HealthCheckerMock) HandlerCalls

func (mock *HealthCheckerMock) HandlerCalls() []struct {
	W   http.ResponseWriter
	Req *http.Request
}

HandlerCalls gets all the calls that were made to Handler. Check the length with:

len(mockedHealthChecker.HandlerCalls())

func (*HealthCheckerMock) Start

func (mock *HealthCheckerMock) Start(ctx context.Context)

Start calls StartFunc.

func (*HealthCheckerMock) StartCalls

func (mock *HealthCheckerMock) StartCalls() []struct {
	Ctx context.Context
}

StartCalls gets all the calls that were made to Start. Check the length with:

len(mockedHealthChecker.StartCalls())

func (*HealthCheckerMock) Stop

func (mock *HealthCheckerMock) Stop()

Stop calls StopFunc.

func (*HealthCheckerMock) StopCalls

func (mock *HealthCheckerMock) StopCalls() []struct {
}

StopCalls gets all the calls that were made to Stop. Check the length with:

len(mockedHealthChecker.StopCalls())

type InitialiserMock

type InitialiserMock struct {
	// GetCantabularClientFunc mocks the GetCantabularClient method.
	GetCantabularClientFunc func(cfg config.CantabularConfig) service.CantabularClient

	// GetDatasetAPIClientFunc mocks the GetDatasetAPIClient method.
	GetDatasetAPIClientFunc func(cfg *config.Config) service.DatasetAPIClient

	// GetHTTPServerFunc mocks the GetHTTPServer method.
	GetHTTPServerFunc func(bindAddr string, router http.Handler) service.HTTPServer

	// GetHTTPServerWithOtelFunc mocks the GetHTTPServerWithOtel method.
	GetHTTPServerWithOtelFunc func(bindAddr string, router http.Handler) service.HTTPServer

	// GetHealthCheckFunc mocks the GetHealthCheck method.
	GetHealthCheckFunc func(cfg *config.Config, time string, commit string, version string) (service.HealthChecker, error)

	// GetMongoClientFunc mocks the GetMongoClient method.
	GetMongoClientFunc func(ctx context.Context, cfg *config.Config) (service.MongoClient, error)

	// GetResponderFunc mocks the GetResponder method.
	GetResponderFunc func() service.Responder
	// contains filtered or unexported fields
}

InitialiserMock is a mock implementation of service.Initialiser.

func TestSomethingThatUsesInitialiser(t *testing.T) {

	// make and configure a mocked service.Initialiser
	mockedInitialiser := &InitialiserMock{
		GetCantabularClientFunc: func(cfg config.CantabularConfig) service.CantabularClient {
			panic("mock out the GetCantabularClient method")
		},
		GetDatasetAPIClientFunc: func(cfg *config.Config) service.DatasetAPIClient {
			panic("mock out the GetDatasetAPIClient method")
		},
		GetHTTPServerFunc: func(bindAddr string, router http.Handler) service.HTTPServer {
			panic("mock out the GetHTTPServer method")
		},
		GetHTTPServerWithOtelFunc: func(bindAddr string, router http.Handler) service.HTTPServer {
			panic("mock out the GetHTTPServerWithOtel method")
		},
		GetHealthCheckFunc: func(cfg *config.Config, time string, commit string, version string) (service.HealthChecker, error) {
			panic("mock out the GetHealthCheck method")
		},
		GetMongoClientFunc: func(ctx context.Context, cfg *config.Config) (service.MongoClient, error) {
			panic("mock out the GetMongoClient method")
		},
		GetResponderFunc: func() service.Responder {
			panic("mock out the GetResponder method")
		},
	}

	// use mockedInitialiser in code that requires service.Initialiser
	// and then make assertions.

}

func (*InitialiserMock) GetCantabularClient added in v1.1.0

func (mock *InitialiserMock) GetCantabularClient(cfg config.CantabularConfig) service.CantabularClient

GetCantabularClient calls GetCantabularClientFunc.

func (*InitialiserMock) GetCantabularClientCalls added in v1.1.0

func (mock *InitialiserMock) GetCantabularClientCalls() []struct {
	Cfg config.CantabularConfig
}

GetCantabularClientCalls gets all the calls that were made to GetCantabularClient. Check the length with:

len(mockedInitialiser.GetCantabularClientCalls())

func (*InitialiserMock) GetDatasetAPIClient added in v1.2.0

func (mock *InitialiserMock) GetDatasetAPIClient(cfg *config.Config) service.DatasetAPIClient

GetDatasetAPIClient calls GetDatasetAPIClientFunc.

func (*InitialiserMock) GetDatasetAPIClientCalls added in v1.2.0

func (mock *InitialiserMock) GetDatasetAPIClientCalls() []struct {
	Cfg *config.Config
}

GetDatasetAPIClientCalls gets all the calls that were made to GetDatasetAPIClient. Check the length with:

len(mockedInitialiser.GetDatasetAPIClientCalls())

func (*InitialiserMock) GetHTTPServer added in v1.1.0

func (mock *InitialiserMock) GetHTTPServer(bindAddr string, router http.Handler) service.HTTPServer

GetHTTPServer calls GetHTTPServerFunc.

func (*InitialiserMock) GetHTTPServerCalls added in v1.1.0

func (mock *InitialiserMock) GetHTTPServerCalls() []struct {
	BindAddr string
	Router   http.Handler
}

GetHTTPServerCalls gets all the calls that were made to GetHTTPServer. Check the length with:

len(mockedInitialiser.GetHTTPServerCalls())

func (*InitialiserMock) GetHTTPServerWithOtel added in v1.31.0

func (mock *InitialiserMock) GetHTTPServerWithOtel(bindAddr string, router http.Handler) service.HTTPServer

GetHTTPServerWithOtel calls GetHTTPServerWithOtelFunc.

func (*InitialiserMock) GetHTTPServerWithOtelCalls added in v1.31.0

func (mock *InitialiserMock) GetHTTPServerWithOtelCalls() []struct {
	BindAddr string
	Router   http.Handler
}

GetHTTPServerWithOtelCalls gets all the calls that were made to GetHTTPServerWithOtel. Check the length with:

len(mockedInitialiser.GetHTTPServerWithOtelCalls())

func (*InitialiserMock) GetHealthCheck added in v1.1.0

func (mock *InitialiserMock) GetHealthCheck(cfg *config.Config, time string, commit string, version string) (service.HealthChecker, error)

GetHealthCheck calls GetHealthCheckFunc.

func (*InitialiserMock) GetHealthCheckCalls added in v1.1.0

func (mock *InitialiserMock) GetHealthCheckCalls() []struct {
	Cfg     *config.Config
	Time    string
	Commit  string
	Version string
}

GetHealthCheckCalls gets all the calls that were made to GetHealthCheck. Check the length with:

len(mockedInitialiser.GetHealthCheckCalls())

func (*InitialiserMock) GetMongoClient added in v1.22.0

func (mock *InitialiserMock) GetMongoClient(ctx context.Context, cfg *config.Config) (service.MongoClient, error)

GetMongoClient calls GetMongoClientFunc.

func (*InitialiserMock) GetMongoClientCalls added in v1.22.0

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

GetMongoClientCalls gets all the calls that were made to GetMongoClient. Check the length with:

len(mockedInitialiser.GetMongoClientCalls())

func (*InitialiserMock) GetResponder added in v1.1.0

func (mock *InitialiserMock) GetResponder() service.Responder

GetResponder calls GetResponderFunc.

func (*InitialiserMock) GetResponderCalls added in v1.1.0

func (mock *InitialiserMock) GetResponderCalls() []struct {
}

GetResponderCalls gets all the calls that were made to GetResponder. Check the length with:

len(mockedInitialiser.GetResponderCalls())

Jump to

Keyboard shortcuts

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