testjob

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 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 DatasetAPIClientMock added in v1.15.0

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

	// PostInstanceFunc mocks the PostInstance method.
	PostInstanceFunc func(ctx context.Context, serviceAuthToken string, newInstance *dataset.NewInstance) (*dataset.Instance, string, error)

	// PutInstanceFunc mocks the PutInstance method.
	PutInstanceFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, instance dataset.UpdateInstance, ifMatch string) (string, error)
	// contains filtered or unexported fields
}

DatasetAPIClientMock is a mock implementation of job.DatasetAPIClient.

    func TestSomethingThatUsesDatasetAPIClient(t *testing.T) {

        // make and configure a mocked job.DatasetAPIClient
        mockedDatasetAPIClient := &DatasetAPIClientMock{
            CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            PostInstanceFunc: func(ctx context.Context, serviceAuthToken string, newInstance *dataset.NewInstance) (*dataset.Instance, string, error) {
	               panic("mock out the PostInstance method")
            },
            PutInstanceFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, instance dataset.UpdateInstance, ifMatch string) (string, error) {
	               panic("mock out the PutInstance method")
            },
        }

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

    }

func (*DatasetAPIClientMock) Checker added in v1.15.0

func (mock *DatasetAPIClientMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*DatasetAPIClientMock) CheckerCalls added in v1.15.0

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

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

len(mockedDatasetAPIClient.CheckerCalls())

func (*DatasetAPIClientMock) PostInstance added in v1.15.0

func (mock *DatasetAPIClientMock) PostInstance(ctx context.Context, serviceAuthToken string, newInstance *dataset.NewInstance) (*dataset.Instance, string, error)

PostInstance calls PostInstanceFunc.

func (*DatasetAPIClientMock) PostInstanceCalls added in v1.15.0

func (mock *DatasetAPIClientMock) PostInstanceCalls() []struct {
	Ctx              context.Context
	ServiceAuthToken string
	NewInstance      *dataset.NewInstance
}

PostInstanceCalls gets all the calls that were made to PostInstance. Check the length with:

len(mockedDatasetAPIClient.PostInstanceCalls())

func (*DatasetAPIClientMock) PutInstance added in v1.15.0

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

PutInstance calls PutInstanceFunc.

func (*DatasetAPIClientMock) PutInstanceCalls added in v1.15.0

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

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

len(mockedDatasetAPIClient.PutInstanceCalls())

type QueueMock

type QueueMock struct {
	// QueueFunc mocks the Queue method.
	QueueFunc func(ctx context.Context, job *models.ImportData) error
	// contains filtered or unexported fields
}

QueueMock is a mock implementation of job.Queue.

    func TestSomethingThatUsesQueue(t *testing.T) {

        // make and configure a mocked job.Queue
        mockedQueue := &QueueMock{
            QueueFunc: func(ctx context.Context, job *models.ImportData) error {
	               panic("mock out the Queue method")
            },
        }

        // use mockedQueue in code that requires job.Queue
        // and then make assertions.

    }

func (*QueueMock) Queue

func (mock *QueueMock) Queue(ctx context.Context, job *models.ImportData) error

Queue calls QueueFunc.

func (*QueueMock) QueueCalls

func (mock *QueueMock) QueueCalls() []struct {
	Ctx context.Context
	Job *models.ImportData
}

QueueCalls gets all the calls that were made to Queue. Check the length with:

len(mockedQueue.QueueCalls())

type RecipeAPIClientMock added in v1.15.0

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

	// 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 job.RecipeAPIClient.

    func TestSomethingThatUsesRecipeAPIClient(t *testing.T) {

        // make and configure a mocked job.RecipeAPIClient
        mockedRecipeAPIClient := &RecipeAPIClientMock{
            CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            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 job.RecipeAPIClient
        // and then make assertions.

    }

func (*RecipeAPIClientMock) Checker added in v1.15.0

func (mock *RecipeAPIClientMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*RecipeAPIClientMock) CheckerCalls added in v1.15.0

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

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

len(mockedRecipeAPIClient.CheckerCalls())

func (*RecipeAPIClientMock) GetRecipe added in v1.15.0

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

GetRecipe calls GetRecipeFunc.

func (*RecipeAPIClientMock) GetRecipeCalls added in v1.15.0

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