mock

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 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.2.0

type CantabularClientMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

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

	// GetAggregatedDimensionOptionsFunc mocks the GetAggregatedDimensionOptions method.
	GetAggregatedDimensionOptionsFunc func(contextMoqParam context.Context, getAggregatedDimensionOptionsRequest cantabular.GetAggregatedDimensionOptionsRequest) (*cantabular.GetAggregatedDimensionOptionsResponse, error)

	// GetDimensionOptionsFunc mocks the GetDimensionOptions method.
	GetDimensionOptionsFunc func(contextMoqParam context.Context, getDimensionOptionsRequest cantabular.GetDimensionOptionsRequest) (*cantabular.GetDimensionOptionsResponse, error)
	// 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{
		CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		CheckerAPIExtFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the CheckerAPIExt method")
		},
		GetAggregatedDimensionOptionsFunc: func(contextMoqParam context.Context, getAggregatedDimensionOptionsRequest cantabular.GetAggregatedDimensionOptionsRequest) (*cantabular.GetAggregatedDimensionOptionsResponse, error) {
			panic("mock out the GetAggregatedDimensionOptions method")
		},
		GetDimensionOptionsFunc: func(contextMoqParam context.Context, getDimensionOptionsRequest cantabular.GetDimensionOptionsRequest) (*cantabular.GetDimensionOptionsResponse, error) {
			panic("mock out the GetDimensionOptions method")
		},
	}

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

}

func (*CantabularClientMock) Checker added in v0.2.0

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

Checker calls CheckerFunc.

func (*CantabularClientMock) CheckerAPIExt added in v0.8.0

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

CheckerAPIExt calls CheckerAPIExtFunc.

func (*CantabularClientMock) CheckerAPIExtCalls added in v0.8.0

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

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

len(mockedCantabularClient.CheckerAPIExtCalls())

func (*CantabularClientMock) CheckerCalls added in v0.2.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())

func (*CantabularClientMock) GetAggregatedDimensionOptions added in v0.11.0

func (mock *CantabularClientMock) GetAggregatedDimensionOptions(contextMoqParam context.Context, getAggregatedDimensionOptionsRequest cantabular.GetAggregatedDimensionOptionsRequest) (*cantabular.GetAggregatedDimensionOptionsResponse, error)

GetAggregatedDimensionOptions calls GetAggregatedDimensionOptionsFunc.

func (*CantabularClientMock) GetAggregatedDimensionOptionsCalls added in v0.11.0

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

GetAggregatedDimensionOptionsCalls gets all the calls that were made to GetAggregatedDimensionOptions. Check the length with:

len(mockedCantabularClient.GetAggregatedDimensionOptionsCalls())

func (*CantabularClientMock) GetDimensionOptions added in v0.8.0

func (mock *CantabularClientMock) GetDimensionOptions(contextMoqParam context.Context, getDimensionOptionsRequest cantabular.GetDimensionOptionsRequest) (*cantabular.GetDimensionOptionsResponse, error)

GetDimensionOptions calls GetDimensionOptionsFunc.

func (*CantabularClientMock) GetDimensionOptionsCalls added in v0.8.0

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

GetDimensionOptionsCalls gets all the calls that were made to GetDimensionOptions. Check the length with:

len(mockedCantabularClient.GetDimensionOptionsCalls())

type DatasetAPIClientMock added in v0.2.0

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

	// GetInstanceFunc mocks the GetInstance method.
	GetInstanceFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, ifMatch string) (dataset.Instance, string, error)

	// PatchInstanceDimensionsFunc mocks the PatchInstanceDimensions method.
	PatchInstanceDimensionsFunc func(ctx context.Context, serviceAuthToken string, instanceID string, upserts []*dataset.OptionPost, updates []*dataset.OptionUpdate, ifMatch string) (string, error)

	// PutInstanceStateFunc mocks the PutInstanceState method.
	PutInstanceStateFunc func(ctx context.Context, serviceAuthToken string, instanceID string, state dataset.State, ifMatch string) (string, 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(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		GetInstanceFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, ifMatch string) (dataset.Instance, string, error) {
			panic("mock out the GetInstance method")
		},
		PatchInstanceDimensionsFunc: func(ctx context.Context, serviceAuthToken string, instanceID string, upserts []*dataset.OptionPost, updates []*dataset.OptionUpdate, ifMatch string) (string, error) {
			panic("mock out the PatchInstanceDimensions method")
		},
		PutInstanceStateFunc: func(ctx context.Context, serviceAuthToken string, instanceID string, state dataset.State, ifMatch string) (string, error) {
			panic("mock out the PutInstanceState method")
		},
	}

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

}

func (*DatasetAPIClientMock) Checker added in v0.2.0

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

Checker calls CheckerFunc.

func (*DatasetAPIClientMock) CheckerCalls added in v0.2.0

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

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

len(mockedDatasetAPIClient.CheckerCalls())

func (*DatasetAPIClientMock) GetInstance added in v0.3.0

func (mock *DatasetAPIClientMock) GetInstance(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, ifMatch string) (dataset.Instance, string, error)

GetInstance calls GetInstanceFunc.

func (*DatasetAPIClientMock) GetInstanceCalls added in v0.3.0

func (mock *DatasetAPIClientMock) GetInstanceCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	InstanceID       string
	IfMatch          string
}

GetInstanceCalls gets all the calls that were made to GetInstance. Check the length with:

len(mockedDatasetAPIClient.GetInstanceCalls())

func (*DatasetAPIClientMock) PatchInstanceDimensions added in v0.5.0

func (mock *DatasetAPIClientMock) PatchInstanceDimensions(ctx context.Context, serviceAuthToken string, instanceID string, upserts []*dataset.OptionPost, updates []*dataset.OptionUpdate, ifMatch string) (string, error)

PatchInstanceDimensions calls PatchInstanceDimensionsFunc.

func (*DatasetAPIClientMock) PatchInstanceDimensionsCalls added in v0.5.0

func (mock *DatasetAPIClientMock) PatchInstanceDimensionsCalls() []struct {
	Ctx              context.Context
	ServiceAuthToken string
	InstanceID       string
	Upserts          []*dataset.OptionPost
	Updates          []*dataset.OptionUpdate
	IfMatch          string
}

PatchInstanceDimensionsCalls gets all the calls that were made to PatchInstanceDimensions. Check the length with:

len(mockedDatasetAPIClient.PatchInstanceDimensionsCalls())

func (*DatasetAPIClientMock) PutInstanceState added in v0.3.0

func (mock *DatasetAPIClientMock) PutInstanceState(ctx context.Context, serviceAuthToken string, instanceID string, state dataset.State, ifMatch string) (string, error)

PutInstanceState calls PutInstanceStateFunc.

func (*DatasetAPIClientMock) PutInstanceStateCalls added in v0.3.0

func (mock *DatasetAPIClientMock) PutInstanceStateCalls() []struct {
	Ctx              context.Context
	ServiceAuthToken string
	InstanceID       string
	State            dataset.State
	IfMatch          string
}

PutInstanceStateCalls gets all the calls that were made to PutInstanceState. Check the length with:

len(mockedDatasetAPIClient.PutInstanceStateCalls())

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 {
	// AddAndGetCheckFunc mocks the AddAndGetCheck method.
	AddAndGetCheckFunc func(name string, checker healthcheck.Checker) (*healthcheck.Check, 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()

	// SubscribeFunc mocks the Subscribe method.
	SubscribeFunc func(s healthcheck.Subscriber, checks ...*healthcheck.Check)
	// 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{
		AddAndGetCheckFunc: func(name string, checker healthcheck.Checker) (*healthcheck.Check, error) {
			panic("mock out the AddAndGetCheck 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")
		},
		SubscribeFunc: func(s healthcheck.Subscriber, checks ...*healthcheck.Check)  {
			panic("mock out the Subscribe method")
		},
	}

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

}

func (*HealthCheckerMock) AddAndGetCheck added in v0.7.0

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

AddAndGetCheck calls AddAndGetCheckFunc.

func (*HealthCheckerMock) AddAndGetCheckCalls added in v0.7.0

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

AddAndGetCheckCalls gets all the calls that were made to AddAndGetCheck. Check the length with:

len(mockedHealthChecker.AddAndGetCheckCalls())

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())

func (*HealthCheckerMock) Subscribe added in v0.7.0

func (mock *HealthCheckerMock) Subscribe(s healthcheck.Subscriber, checks ...*healthcheck.Check)

Subscribe calls SubscribeFunc.

func (*HealthCheckerMock) SubscribeCalls added in v0.7.0

func (mock *HealthCheckerMock) SubscribeCalls() []struct {
	S      healthcheck.Subscriber
	Checks []*healthcheck.Check
}

SubscribeCalls gets all the calls that were made to Subscribe. Check the length with:

len(mockedHealthChecker.SubscribeCalls())

type ImportAPIClientMock added in v0.3.0

type ImportAPIClientMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

	// IncreaseProcessedInstanceCountFunc mocks the IncreaseProcessedInstanceCount method.
	IncreaseProcessedInstanceCountFunc func(ctx context.Context, jobID string, serviceToken string, instanceID string) ([]importapi.ProcessedInstances, error)

	// UpdateImportJobStateFunc mocks the UpdateImportJobState method.
	UpdateImportJobStateFunc func(ctx context.Context, jobID string, serviceToken string, newState importapi.State) error
	// contains filtered or unexported fields
}

ImportAPIClientMock is a mock implementation of service.ImportAPIClient.

func TestSomethingThatUsesImportAPIClient(t *testing.T) {

	// make and configure a mocked service.ImportAPIClient
	mockedImportAPIClient := &ImportAPIClientMock{
		CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		IncreaseProcessedInstanceCountFunc: func(ctx context.Context, jobID string, serviceToken string, instanceID string) ([]importapi.ProcessedInstances, error) {
			panic("mock out the IncreaseProcessedInstanceCount method")
		},
		UpdateImportJobStateFunc: func(ctx context.Context, jobID string, serviceToken string, newState importapi.State) error {
			panic("mock out the UpdateImportJobState method")
		},
	}

	// use mockedImportAPIClient in code that requires service.ImportAPIClient
	// and then make assertions.

}

func (*ImportAPIClientMock) Checker added in v0.3.0

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

Checker calls CheckerFunc.

func (*ImportAPIClientMock) CheckerCalls added in v0.3.0

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

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

len(mockedImportAPIClient.CheckerCalls())

func (*ImportAPIClientMock) IncreaseProcessedInstanceCount added in v0.4.0

func (mock *ImportAPIClientMock) IncreaseProcessedInstanceCount(ctx context.Context, jobID string, serviceToken string, instanceID string) ([]importapi.ProcessedInstances, error)

IncreaseProcessedInstanceCount calls IncreaseProcessedInstanceCountFunc.

func (*ImportAPIClientMock) IncreaseProcessedInstanceCountCalls added in v0.4.0

func (mock *ImportAPIClientMock) IncreaseProcessedInstanceCountCalls() []struct {
	Ctx          context.Context
	JobID        string
	ServiceToken string
	InstanceID   string
}

IncreaseProcessedInstanceCountCalls gets all the calls that were made to IncreaseProcessedInstanceCount. Check the length with:

len(mockedImportAPIClient.IncreaseProcessedInstanceCountCalls())

func (*ImportAPIClientMock) UpdateImportJobState added in v0.3.0

func (mock *ImportAPIClientMock) UpdateImportJobState(ctx context.Context, jobID string, serviceToken string, newState importapi.State) error

UpdateImportJobState calls UpdateImportJobStateFunc.

func (*ImportAPIClientMock) UpdateImportJobStateCalls added in v0.3.0

func (mock *ImportAPIClientMock) UpdateImportJobStateCalls() []struct {
	Ctx          context.Context
	JobID        string
	ServiceToken string
	NewState     importapi.State
}

UpdateImportJobStateCalls gets all the calls that were made to UpdateImportJobState. Check the length with:

len(mockedImportAPIClient.UpdateImportJobStateCalls())

Jump to

Keyboard shortcuts

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