mock

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 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 DatasetClientMock

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

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

	// GetInstancesFunc mocks the GetInstances method.
	GetInstancesFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, vars url.Values) (dataset.Instances, error)

	// PutInstanceImportTasksFunc mocks the PutInstanceImportTasks method.
	PutInstanceImportTasksFunc func(ctx context.Context, serviceAuthToken string, instanceID string, data dataset.InstanceImportTasks) error

	// PutInstanceStateFunc mocks the PutInstanceState method.
	PutInstanceStateFunc func(ctx context.Context, serviceAuthToken string, instanceID string, state dataset.State) error

	// UpdateInstanceWithNewInsertsFunc mocks the UpdateInstanceWithNewInserts method.
	UpdateInstanceWithNewInsertsFunc func(ctx context.Context, serviceAuthToken string, instanceID string, observationsInserted int32) error
	// contains filtered or unexported fields
}

DatasetClientMock is a mock implementation of api.DatasetClient.

    func TestSomethingThatUsesDatasetClient(t *testing.T) {

        // make and configure a mocked api.DatasetClient
        mockedDatasetClient := &DatasetClientMock{
            CheckerFunc: func(ctx context.Context, check *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            GetInstanceFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string) (dataset.Instance, error) {
	               panic("mock out the GetInstance method")
            },
            GetInstancesFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, vars url.Values) (dataset.Instances, error) {
	               panic("mock out the GetInstances method")
            },
            PutInstanceImportTasksFunc: func(ctx context.Context, serviceAuthToken string, instanceID string, data dataset.InstanceImportTasks) error {
	               panic("mock out the PutInstanceImportTasks method")
            },
            PutInstanceStateFunc: func(ctx context.Context, serviceAuthToken string, instanceID string, state dataset.State) error {
	               panic("mock out the PutInstanceState method")
            },
            UpdateInstanceWithNewInsertsFunc: func(ctx context.Context, serviceAuthToken string, instanceID string, observationsInserted int32) error {
	               panic("mock out the UpdateInstanceWithNewInserts method")
            },
        }

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

    }

func (*DatasetClientMock) Checker

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

Checker calls CheckerFunc.

func (*DatasetClientMock) CheckerCalls

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

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

len(mockedDatasetClient.CheckerCalls())

func (*DatasetClientMock) GetInstance

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

GetInstance calls GetInstanceFunc.

func (*DatasetClientMock) GetInstanceCalls

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

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

len(mockedDatasetClient.GetInstanceCalls())

func (*DatasetClientMock) GetInstances

func (mock *DatasetClientMock) GetInstances(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, vars url.Values) (dataset.Instances, error)

GetInstances calls GetInstancesFunc.

func (*DatasetClientMock) GetInstancesCalls

func (mock *DatasetClientMock) GetInstancesCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	Vars             url.Values
}

GetInstancesCalls gets all the calls that were made to GetInstances. Check the length with:

len(mockedDatasetClient.GetInstancesCalls())

func (*DatasetClientMock) PutInstanceImportTasks

func (mock *DatasetClientMock) PutInstanceImportTasks(ctx context.Context, serviceAuthToken string, instanceID string, data dataset.InstanceImportTasks) error

PutInstanceImportTasks calls PutInstanceImportTasksFunc.

func (*DatasetClientMock) PutInstanceImportTasksCalls

func (mock *DatasetClientMock) PutInstanceImportTasksCalls() []struct {
	Ctx              context.Context
	ServiceAuthToken string
	InstanceID       string
	Data             dataset.InstanceImportTasks
}

PutInstanceImportTasksCalls gets all the calls that were made to PutInstanceImportTasks. Check the length with:

len(mockedDatasetClient.PutInstanceImportTasksCalls())

func (*DatasetClientMock) PutInstanceState

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

PutInstanceState calls PutInstanceStateFunc.

func (*DatasetClientMock) PutInstanceStateCalls

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

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

len(mockedDatasetClient.PutInstanceStateCalls())

func (*DatasetClientMock) UpdateInstanceWithNewInserts

func (mock *DatasetClientMock) UpdateInstanceWithNewInserts(ctx context.Context, serviceAuthToken string, instanceID string, observationsInserted int32) error

UpdateInstanceWithNewInserts calls UpdateInstanceWithNewInsertsFunc.

func (*DatasetClientMock) UpdateInstanceWithNewInsertsCalls

func (mock *DatasetClientMock) UpdateInstanceWithNewInsertsCalls() []struct {
	Ctx                  context.Context
	ServiceAuthToken     string
	InstanceID           string
	ObservationsInserted int32
}

UpdateInstanceWithNewInsertsCalls gets all the calls that were made to UpdateInstanceWithNewInserts. Check the length with:

len(mockedDatasetClient.UpdateInstanceWithNewInsertsCalls())

type ImportAPIClientMock

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

	// GetImportJobFunc mocks the GetImportJob method.
	GetImportJobFunc func(ctx context.Context, importJobID string, serviceToken string) (importapi.ImportJob, error)

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

ImportAPIClientMock is a mock implementation of api.ImportAPIClient.

    func TestSomethingThatUsesImportAPIClient(t *testing.T) {

        // make and configure a mocked api.ImportAPIClient
        mockedImportAPIClient := &ImportAPIClientMock{
            CheckerFunc: func(ctx context.Context, check *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            GetImportJobFunc: func(ctx context.Context, importJobID string, serviceToken string) (importapi.ImportJob, error) {
	               panic("mock out the GetImportJob method")
            },
            UpdateImportJobStateFunc: func(ctx context.Context, jobID string, serviceToken string, newState string) error {
	               panic("mock out the UpdateImportJobState method")
            },
        }

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

    }

func (*ImportAPIClientMock) Checker

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

Checker calls CheckerFunc.

func (*ImportAPIClientMock) CheckerCalls

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

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

len(mockedImportAPIClient.CheckerCalls())

func (*ImportAPIClientMock) GetImportJob

func (mock *ImportAPIClientMock) GetImportJob(ctx context.Context, importJobID string, serviceToken string) (importapi.ImportJob, error)

GetImportJob calls GetImportJobFunc.

func (*ImportAPIClientMock) GetImportJobCalls

func (mock *ImportAPIClientMock) GetImportJobCalls() []struct {
	Ctx          context.Context
	ImportJobID  string
	ServiceToken string
}

GetImportJobCalls gets all the calls that were made to GetImportJob. Check the length with:

len(mockedImportAPIClient.GetImportJobCalls())

func (*ImportAPIClientMock) UpdateImportJobState

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

UpdateImportJobState calls UpdateImportJobStateFunc.

func (*ImportAPIClientMock) UpdateImportJobStateCalls

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

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