mock

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CantabularClientMock added in v0.8.0

type CantabularClientMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
	// contains filtered or unexported fields
}

CantabularClientMock is a mock implementation of api.CantabularClient.

func TestSomethingThatUsesCantabularClient(t *testing.T) {

	// make and configure a mocked api.CantabularClient
	mockedCantabularClient := &CantabularClientMock{
		CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
	}

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

}

func (*CantabularClientMock) Checker added in v0.8.0

func (mock *CantabularClientMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*CantabularClientMock) CheckerCalls added in v0.8.0

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

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

len(mockedCantabularClient.CheckerCalls())

type IAuthHandlerMock

type IAuthHandlerMock struct {
	// RequireFunc mocks the Require method.
	RequireFunc func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
	// contains filtered or unexported fields
}

IAuthHandlerMock is a mock implementation of api.IAuthHandler.

func TestSomethingThatUsesIAuthHandler(t *testing.T) {

	// make and configure a mocked api.IAuthHandler
	mockedIAuthHandler := &IAuthHandlerMock{
		RequireFunc: func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc {
			panic("mock out the Require method")
		},
	}

	// use mockedIAuthHandler in code that requires api.IAuthHandler
	// and then make assertions.

}

func (*IAuthHandlerMock) Require

func (mock *IAuthHandlerMock) Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc

Require calls RequireFunc.

func (*IAuthHandlerMock) RequireCalls

func (mock *IAuthHandlerMock) RequireCalls() []struct {
	Required auth.Permissions
	Handler  http.HandlerFunc
}

RequireCalls gets all the calls that were made to Require. Check the length with:

len(mockedIAuthHandler.RequireCalls())

type IDatasetClientMock

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

	// GetFunc mocks the Get method.
	GetFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string) (dataset.DatasetDetails, error)

	// GetOptionsFunc mocks the GetOptions method.
	GetOptionsFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, id string, edition string, version string, dimension string, q *dataset.QueryParams) (dataset.Options, error)

	// GetVersionFunc mocks the GetVersion method.
	GetVersionFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceAuthToken string, collectionID string, datasetID string, edition string, version string) (dataset.Version, error)
	// contains filtered or unexported fields
}

IDatasetClientMock is a mock implementation of api.IDatasetClient.

func TestSomethingThatUsesIDatasetClient(t *testing.T) {

	// make and configure a mocked api.IDatasetClient
	mockedIDatasetClient := &IDatasetClientMock{
		CheckerFunc: func(ctx context.Context, check *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		GetFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string) (dataset.DatasetDetails, error) {
			panic("mock out the Get method")
		},
		GetOptionsFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, id string, edition string, version string, dimension string, q *dataset.QueryParams) (dataset.Options, error) {
			panic("mock out the GetOptions method")
		},
		GetVersionFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceAuthToken string, collectionID string, datasetID string, edition string, version string) (dataset.Version, error) {
			panic("mock out the GetVersion method")
		},
	}

	// use mockedIDatasetClient in code that requires api.IDatasetClient
	// and then make assertions.

}

func (*IDatasetClientMock) Checker

func (mock *IDatasetClientMock) Checker(ctx context.Context, check *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*IDatasetClientMock) CheckerCalls

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

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

len(mockedIDatasetClient.CheckerCalls())

func (*IDatasetClientMock) Get

func (mock *IDatasetClientMock) Get(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string) (dataset.DatasetDetails, error)

Get calls GetFunc.

func (*IDatasetClientMock) GetCalls

func (mock *IDatasetClientMock) GetCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	DatasetID        string
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedIDatasetClient.GetCalls())

func (*IDatasetClientMock) GetOptions added in v0.7.0

func (mock *IDatasetClientMock) GetOptions(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, id string, edition string, version string, dimension string, q *dataset.QueryParams) (dataset.Options, error)

GetOptions calls GetOptionsFunc.

func (*IDatasetClientMock) GetOptionsCalls added in v0.7.0

func (mock *IDatasetClientMock) GetOptionsCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	ID               string
	Edition          string
	Version          string
	Dimension        string
	Q                *dataset.QueryParams
}

GetOptionsCalls gets all the calls that were made to GetOptions. Check the length with:

len(mockedIDatasetClient.GetOptionsCalls())

func (*IDatasetClientMock) GetVersion

func (mock *IDatasetClientMock) GetVersion(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceAuthToken string, collectionID string, datasetID string, edition string, version string) (dataset.Version, error)

GetVersion calls GetVersionFunc.

func (*IDatasetClientMock) GetVersionCalls

func (mock *IDatasetClientMock) GetVersionCalls() []struct {
	Ctx                      context.Context
	UserAuthToken            string
	ServiceAuthToken         string
	DownloadServiceAuthToken string
	CollectionID             string
	DatasetID                string
	Edition                  string
	Version                  string
}

GetVersionCalls gets all the calls that were made to GetVersion. Check the length with:

len(mockedIDatasetClient.GetVersionCalls())

type IGraphMock

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

	// CloseFunc mocks the Close method.
	CloseFunc func(ctx context.Context) error

	// ErrorChanFunc mocks the ErrorChan method.
	ErrorChanFunc func() chan error

	// HealthcheckFunc mocks the Healthcheck method.
	HealthcheckFunc func() (string, error)

	// StreamCSVRowsFunc mocks the StreamCSVRows method.
	StreamCSVRowsFunc func(ctx context.Context, instanceID string, filterID string, filters *observation.DimensionFilters, limit *int) (observation.StreamRowReader, error)
	// contains filtered or unexported fields
}

IGraphMock is a mock implementation of api.IGraph.

func TestSomethingThatUsesIGraph(t *testing.T) {

	// make and configure a mocked api.IGraph
	mockedIGraph := &IGraphMock{
		CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		CloseFunc: func(ctx context.Context) error {
			panic("mock out the Close method")
		},
		ErrorChanFunc: func() chan error {
			panic("mock out the ErrorChan method")
		},
		HealthcheckFunc: func() (string, error) {
			panic("mock out the Healthcheck method")
		},
		StreamCSVRowsFunc: func(ctx context.Context, instanceID string, filterID string, filters *observation.DimensionFilters, limit *int) (observation.StreamRowReader, error) {
			panic("mock out the StreamCSVRows method")
		},
	}

	// use mockedIGraph in code that requires api.IGraph
	// and then make assertions.

}

func (*IGraphMock) Checker

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

Checker calls CheckerFunc.

func (*IGraphMock) CheckerCalls

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

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

len(mockedIGraph.CheckerCalls())

func (*IGraphMock) Close

func (mock *IGraphMock) Close(ctx context.Context) error

Close calls CloseFunc.

func (*IGraphMock) CloseCalls

func (mock *IGraphMock) CloseCalls() []struct {
	Ctx context.Context
}

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

len(mockedIGraph.CloseCalls())

func (*IGraphMock) ErrorChan added in v0.5.0

func (mock *IGraphMock) ErrorChan() chan error

ErrorChan calls ErrorChanFunc.

func (*IGraphMock) ErrorChanCalls added in v0.5.0

func (mock *IGraphMock) ErrorChanCalls() []struct {
}

ErrorChanCalls gets all the calls that were made to ErrorChan. Check the length with:

len(mockedIGraph.ErrorChanCalls())

func (*IGraphMock) Healthcheck

func (mock *IGraphMock) Healthcheck() (string, error)

Healthcheck calls HealthcheckFunc.

func (*IGraphMock) HealthcheckCalls

func (mock *IGraphMock) HealthcheckCalls() []struct {
}

HealthcheckCalls gets all the calls that were made to Healthcheck. Check the length with:

len(mockedIGraph.HealthcheckCalls())

func (*IGraphMock) StreamCSVRows

func (mock *IGraphMock) StreamCSVRows(ctx context.Context, instanceID string, filterID string, filters *observation.DimensionFilters, limit *int) (observation.StreamRowReader, error)

StreamCSVRows calls StreamCSVRowsFunc.

func (*IGraphMock) StreamCSVRowsCalls

func (mock *IGraphMock) StreamCSVRowsCalls() []struct {
	Ctx        context.Context
	InstanceID string
	FilterID   string
	Filters    *observation.DimensionFilters
	Limit      *int
}

StreamCSVRowsCalls gets all the calls that were made to StreamCSVRows. Check the length with:

len(mockedIGraph.StreamCSVRowsCalls())

Jump to

Keyboard shortcuts

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