mocks

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 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 ClientMock

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

	// GetJobFunc mocks the GetJob method.
	GetJobFunc func(ctx context.Context, reqheader sdk.Headers, jobID string) (*sdk.RespHeaders, *models.Job, error)

	// GetJobsFunc mocks the GetJobs method.
	GetJobsFunc func(ctx context.Context, reqheader sdk.Headers, options sdk.Options) (*sdk.RespHeaders, *models.Jobs, error)

	// GetTaskFunc mocks the GetTask method.
	GetTaskFunc func(ctx context.Context, headers sdk.Headers, jobID string, taskName string) (*sdk.RespHeaders, *models.Task, error)

	// GetTasksFunc mocks the GetTasks method.
	GetTasksFunc func(ctx context.Context, reqheader sdk.Headers, jobID string) (*sdk.RespHeaders, *models.Tasks, error)

	// HealthFunc mocks the Health method.
	HealthFunc func() *health.Client

	// PatchJobFunc mocks the PatchJob method.
	PatchJobFunc func(ctx context.Context, headers sdk.Headers, jobID string, body []sdk.PatchOperation) (*sdk.RespHeaders, error)

	// PostJobFunc mocks the PostJob method.
	PostJobFunc func(ctx context.Context, headers sdk.Headers) (*models.Job, error)

	// PostTaskFunc mocks the PostTask method.
	PostTaskFunc func(ctx context.Context, headers sdk.Headers, jobID string, taskToCreate models.TaskToCreate) (*sdk.RespHeaders, *models.Task, error)

	// PutJobNumberOfTasksFunc mocks the PutJobNumberOfTasks method.
	PutJobNumberOfTasksFunc func(ctx context.Context, reqHeaders sdk.Headers, jobID string, numTasks string) (*sdk.RespHeaders, error)

	// URLFunc mocks the URL method.
	URLFunc func() string
	// contains filtered or unexported fields
}

ClientMock is a mock implementation of sdk.Client.

    func TestSomethingThatUsesClient(t *testing.T) {

        // make and configure a mocked sdk.Client
        mockedClient := &ClientMock{
            CheckerFunc: func(ctx context.Context, check *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            GetJobFunc: func(ctx context.Context, reqheader sdk.Headers, jobID string) (*sdk.RespHeaders, *models.Job, error) {
	               panic("mock out the GetJob method")
            },
            GetJobsFunc: func(ctx context.Context, reqheader sdk.Headers, options sdk.Options) (*sdk.RespHeaders, *models.Jobs, error) {
	               panic("mock out the GetJobs method")
            },
            GetTaskFunc: func(ctx context.Context, headers sdk.Headers, jobID string, taskName string) (*sdk.RespHeaders, *models.Task, error) {
	               panic("mock out the GetTask method")
            },
            GetTasksFunc: func(ctx context.Context, reqheader sdk.Headers, jobID string) (*sdk.RespHeaders, *models.Tasks, error) {
	               panic("mock out the GetTasks method")
            },
            HealthFunc: func() *health.Client {
	               panic("mock out the Health method")
            },
            PatchJobFunc: func(ctx context.Context, headers sdk.Headers, jobID string, body []sdk.PatchOperation) (*sdk.RespHeaders, error) {
	               panic("mock out the PatchJob method")
            },
            PostJobFunc: func(ctx context.Context, headers sdk.Headers) (*models.Job, error) {
	               panic("mock out the PostJob method")
            },
            PostTaskFunc: func(ctx context.Context, headers sdk.Headers, jobID string, taskToCreate models.TaskToCreate) (*sdk.RespHeaders, *models.Task, error) {
	               panic("mock out the PostTask method")
            },
            PutJobNumberOfTasksFunc: func(ctx context.Context, reqHeaders sdk.Headers, jobID string, numTasks string) (*sdk.RespHeaders, error) {
	               panic("mock out the PutJobNumberOfTasks method")
            },
            URLFunc: func() string {
	               panic("mock out the URL method")
            },
        }

        // use mockedClient in code that requires sdk.Client
        // and then make assertions.

    }

func (*ClientMock) Checker added in v0.16.1

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

Checker calls CheckerFunc.

func (*ClientMock) CheckerCalls added in v0.16.1

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

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

len(mockedClient.CheckerCalls())

func (*ClientMock) GetJob added in v0.20.0

func (mock *ClientMock) GetJob(ctx context.Context, reqheader sdk.Headers, jobID string) (*sdk.RespHeaders, *models.Job, error)

GetJob calls GetJobFunc.

func (*ClientMock) GetJobCalls added in v0.20.0

func (mock *ClientMock) GetJobCalls() []struct {
	Ctx       context.Context
	Reqheader sdk.Headers
	JobID     string
}

GetJobCalls gets all the calls that were made to GetJob. Check the length with:

len(mockedClient.GetJobCalls())

func (*ClientMock) GetJobs added in v0.20.0

func (mock *ClientMock) GetJobs(ctx context.Context, reqheader sdk.Headers, options sdk.Options) (*sdk.RespHeaders, *models.Jobs, error)

GetJobs calls GetJobsFunc.

func (*ClientMock) GetJobsCalls added in v0.20.0

func (mock *ClientMock) GetJobsCalls() []struct {
	Ctx       context.Context
	Reqheader sdk.Headers
	Options   sdk.Options
}

GetJobsCalls gets all the calls that were made to GetJobs. Check the length with:

len(mockedClient.GetJobsCalls())

func (*ClientMock) GetTask added in v0.18.0

func (mock *ClientMock) GetTask(ctx context.Context, headers sdk.Headers, jobID string, taskName string) (*sdk.RespHeaders, *models.Task, error)

GetTask calls GetTaskFunc.

func (*ClientMock) GetTaskCalls added in v0.18.0

func (mock *ClientMock) GetTaskCalls() []struct {
	Ctx      context.Context
	Headers  sdk.Headers
	JobID    string
	TaskName string
}

GetTaskCalls gets all the calls that were made to GetTask. Check the length with:

len(mockedClient.GetTaskCalls())

func (*ClientMock) GetTasks added in v0.20.0

func (mock *ClientMock) GetTasks(ctx context.Context, reqheader sdk.Headers, jobID string) (*sdk.RespHeaders, *models.Tasks, error)

GetTasks calls GetTasksFunc.

func (*ClientMock) GetTasksCalls added in v0.20.0

func (mock *ClientMock) GetTasksCalls() []struct {
	Ctx       context.Context
	Reqheader sdk.Headers
	JobID     string
}

GetTasksCalls gets all the calls that were made to GetTasks. Check the length with:

len(mockedClient.GetTasksCalls())

func (*ClientMock) Health added in v0.16.1

func (mock *ClientMock) Health() *health.Client

Health calls HealthFunc.

func (*ClientMock) HealthCalls added in v0.16.1

func (mock *ClientMock) HealthCalls() []struct {
}

HealthCalls gets all the calls that were made to Health. Check the length with:

len(mockedClient.HealthCalls())

func (*ClientMock) PatchJob added in v0.17.0

func (mock *ClientMock) PatchJob(ctx context.Context, headers sdk.Headers, jobID string, body []sdk.PatchOperation) (*sdk.RespHeaders, error)

PatchJob calls PatchJobFunc.

func (*ClientMock) PatchJobCalls added in v0.17.0

func (mock *ClientMock) PatchJobCalls() []struct {
	Ctx     context.Context
	Headers sdk.Headers
	JobID   string
	Body    []sdk.PatchOperation
}

PatchJobCalls gets all the calls that were made to PatchJob. Check the length with:

len(mockedClient.PatchJobCalls())

func (*ClientMock) PostJob

func (mock *ClientMock) PostJob(ctx context.Context, headers sdk.Headers) (*models.Job, error)

PostJob calls PostJobFunc.

func (*ClientMock) PostJobCalls

func (mock *ClientMock) PostJobCalls() []struct {
	Ctx     context.Context
	Headers sdk.Headers
}

PostJobCalls gets all the calls that were made to PostJob. Check the length with:

len(mockedClient.PostJobCalls())

func (*ClientMock) PostTask added in v0.19.0

func (mock *ClientMock) PostTask(ctx context.Context, headers sdk.Headers, jobID string, taskToCreate models.TaskToCreate) (*sdk.RespHeaders, *models.Task, error)

PostTask calls PostTaskFunc.

func (*ClientMock) PostTaskCalls added in v0.19.0

func (mock *ClientMock) PostTaskCalls() []struct {
	Ctx          context.Context
	Headers      sdk.Headers
	JobID        string
	TaskToCreate models.TaskToCreate
}

PostTaskCalls gets all the calls that were made to PostTask. Check the length with:

len(mockedClient.PostTaskCalls())

func (*ClientMock) PutJobNumberOfTasks added in v0.20.0

func (mock *ClientMock) PutJobNumberOfTasks(ctx context.Context, reqHeaders sdk.Headers, jobID string, numTasks string) (*sdk.RespHeaders, error)

PutJobNumberOfTasks calls PutJobNumberOfTasksFunc.

func (*ClientMock) PutJobNumberOfTasksCalls added in v0.20.0

func (mock *ClientMock) PutJobNumberOfTasksCalls() []struct {
	Ctx        context.Context
	ReqHeaders sdk.Headers
	JobID      string
	NumTasks   string
}

PutJobNumberOfTasksCalls gets all the calls that were made to PutJobNumberOfTasks. Check the length with:

len(mockedClient.PutJobNumberOfTasksCalls())

func (*ClientMock) URL added in v0.16.1

func (mock *ClientMock) URL() string

URL calls URLFunc.

func (*ClientMock) URLCalls added in v0.16.1

func (mock *ClientMock) URLCalls() []struct {
}

URLCalls gets all the calls that were made to URL. Check the length with:

len(mockedClient.URLCalls())

Jump to

Keyboard shortcuts

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