mocks

package
v1.94.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatasetClientMock

type DatasetClientMock struct {
	// GetFunc mocks the Get method.
	GetFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string) (dataset.DatasetDetails, error)
	// contains filtered or unexported fields
}

DatasetClientMock is a mock implementation of datasetType.DatasetClient.

func TestSomethingThatUsesDatasetClient(t *testing.T) {

	// make and configure a mocked datasetType.DatasetClient
	mockedDatasetClient := &DatasetClientMock{
		GetFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string) (dataset.DatasetDetails, error) {
			panic("mock out the Get method")
		},
	}

	// use mockedDatasetClient in code that requires datasetType.DatasetClient
	// and then make assertions.

}

func (*DatasetClientMock) Get

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

Get calls GetFunc.

func (*DatasetClientMock) GetCalls

func (mock *DatasetClientMock) 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(mockedDatasetClient.GetCalls())

type FilterClientMock

type FilterClientMock struct {
	// GetJobStateFunc mocks the GetJobState method.
	GetJobStateFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceToken string, collectionID string, filterID string) (filter.Model, string, error)
	// contains filtered or unexported fields
}

FilterClientMock is a mock implementation of datasetType.FilterClient.

func TestSomethingThatUsesFilterClient(t *testing.T) {

	// make and configure a mocked datasetType.FilterClient
	mockedFilterClient := &FilterClientMock{
		GetJobStateFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceToken string, collectionID string, filterID string) (filter.Model, string, error) {
			panic("mock out the GetJobState method")
		},
	}

	// use mockedFilterClient in code that requires datasetType.FilterClient
	// and then make assertions.

}

func (*FilterClientMock) GetJobState

func (mock *FilterClientMock) GetJobState(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceToken string, collectionID string, filterID string) (filter.Model, string, error)

GetJobState calls GetJobStateFunc.

func (*FilterClientMock) GetJobStateCalls

func (mock *FilterClientMock) GetJobStateCalls() []struct {
	Ctx                  context.Context
	UserAuthToken        string
	ServiceAuthToken     string
	DownloadServiceToken string
	CollectionID         string
	FilterID             string
}

GetJobStateCalls gets all the calls that were made to GetJobState. Check the length with:

len(mockedFilterClient.GetJobStateCalls())

Jump to

Keyboard shortcuts

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