mock

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CantabularClientMock

type CantabularClientMock struct {
	// 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 handler.CantabularClient.

func TestSomethingThatUsesCantabularClient(t *testing.T) {

	// make and configure a mocked handler.CantabularClient
	mockedCantabularClient := &CantabularClientMock{
		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 handler.CantabularClient
	// and then make assertions.

}

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

type DatasetAPIClientMock struct {
	// 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 handler.DatasetAPIClient.

func TestSomethingThatUsesDatasetAPIClient(t *testing.T) {

	// make and configure a mocked handler.DatasetAPIClient
	mockedDatasetAPIClient := &DatasetAPIClientMock{
		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 handler.DatasetAPIClient
	// and then make assertions.

}

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 ImportAPIClientMock added in v0.3.0

type ImportAPIClientMock struct {
	// 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 handler.ImportAPIClient.

func TestSomethingThatUsesImportAPIClient(t *testing.T) {

	// make and configure a mocked handler.ImportAPIClient
	mockedImportAPIClient := &ImportAPIClientMock{
		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 handler.ImportAPIClient
	// and then make assertions.

}

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