mock

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 7 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 {
	// GetDimensionsByNameFunc mocks the GetDimensionsByName method.
	GetDimensionsByNameFunc func(ctx context.Context, req cantabular.GetDimensionsByNameRequest) (*cantabular.GetDimensionsResponse, 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{
		GetDimensionsByNameFunc: func(ctx context.Context, req cantabular.GetDimensionsByNameRequest) (*cantabular.GetDimensionsResponse, error) {
			panic("mock out the GetDimensionsByName method")
		},
	}

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

}

func (*CantabularClientMock) GetDimensionsByName added in v1.8.0

GetDimensionsByName calls GetDimensionsByNameFunc.

func (*CantabularClientMock) GetDimensionsByNameCalls added in v1.8.0

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

GetDimensionsByNameCalls gets all the calls that were made to GetDimensionsByName. Check the length with:

len(mockedCantabularClient.GetDimensionsByNameCalls())

type DatasetAPIClientMock

type DatasetAPIClientMock struct {
	// PutInstanceFunc mocks the PutInstance method.
	PutInstanceFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, i dataset.UpdateInstance, 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{
		PutInstanceFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, i dataset.UpdateInstance, ifMatch string) (string, error) {
			panic("mock out the PutInstance 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) PutInstance

func (mock *DatasetAPIClientMock) PutInstance(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, i dataset.UpdateInstance, ifMatch string) (string, error)

PutInstance calls PutInstanceFunc.

func (*DatasetAPIClientMock) PutInstanceCalls

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

PutInstanceCalls gets all the calls that were made to PutInstance. Check the length with:

len(mockedDatasetAPIClient.PutInstanceCalls())

func (*DatasetAPIClientMock) PutInstanceState

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

PutInstanceState calls PutInstanceStateFunc.

func (*DatasetAPIClientMock) PutInstanceStateCalls

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 v1.7.0

type ImportAPIClientMock struct {
	// 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{
		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) UpdateImportJobState added in v1.7.0

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

UpdateImportJobState calls UpdateImportJobStateFunc.

func (*ImportAPIClientMock) UpdateImportJobStateCalls added in v1.7.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())

type RecipeAPIClientMock

type RecipeAPIClientMock struct {
	// GetRecipeFunc mocks the GetRecipe method.
	GetRecipeFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, recipeID string) (*recipe.Recipe, error)
	// contains filtered or unexported fields
}

RecipeAPIClientMock is a mock implementation of handler.RecipeAPIClient.

func TestSomethingThatUsesRecipeAPIClient(t *testing.T) {

	// make and configure a mocked handler.RecipeAPIClient
	mockedRecipeAPIClient := &RecipeAPIClientMock{
		GetRecipeFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, recipeID string) (*recipe.Recipe, error) {
			panic("mock out the GetRecipe method")
		},
	}

	// use mockedRecipeAPIClient in code that requires handler.RecipeAPIClient
	// and then make assertions.

}

func (*RecipeAPIClientMock) GetRecipe

func (mock *RecipeAPIClientMock) GetRecipe(ctx context.Context, userAuthToken string, serviceAuthToken string, recipeID string) (*recipe.Recipe, error)

GetRecipe calls GetRecipeFunc.

func (*RecipeAPIClientMock) GetRecipeCalls

func (mock *RecipeAPIClientMock) GetRecipeCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	RecipeID         string
}

GetRecipeCalls gets all the calls that were made to GetRecipe. Check the length with:

len(mockedRecipeAPIClient.GetRecipeCalls())

Jump to

Keyboard shortcuts

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