mock

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 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 JobStorerMock added in v0.5.0

type JobStorerMock struct {
	// AcquireJobLockFunc mocks the AcquireJobLock method.
	AcquireJobLockFunc func(ctx context.Context, id string) (string, error)

	// CreateJobFunc mocks the CreateJob method.
	CreateJobFunc func(ctx context.Context, id string) (models.Job, error)

	// GetJobFunc mocks the GetJob method.
	GetJobFunc func(ctx context.Context, id string) (models.Job, error)

	// GetJobsFunc mocks the GetJobs method.
	GetJobsFunc func(ctx context.Context, offsetParam string, limitParam string) (models.Jobs, error)

	// PutNumberOfTasksFunc mocks the PutNumberOfTasks method.
	PutNumberOfTasksFunc func(ctx context.Context, id string, count int) error

	// UnlockJobFunc mocks the UnlockJob method.
	UnlockJobFunc func(lockID string) error
	// contains filtered or unexported fields
}

JobStorerMock is a mock implementation of api.JobStorer.

func TestSomethingThatUsesJobStorer(t *testing.T) {

	// make and configure a mocked api.JobStorer
	mockedJobStorer := &JobStorerMock{
		AcquireJobLockFunc: func(ctx context.Context, id string) (string, error) {
			panic("mock out the AcquireJobLock method")
		},
		CreateJobFunc: func(ctx context.Context, id string) (models.Job, error) {
			panic("mock out the CreateJob method")
		},
		GetJobFunc: func(ctx context.Context, id string) (models.Job, error) {
			panic("mock out the GetJob method")
		},
		GetJobsFunc: func(ctx context.Context, offsetParam string, limitParam string) (models.Jobs, error) {
			panic("mock out the GetJobs method")
		},
		PutNumberOfTasksFunc: func(ctx context.Context, id string, count int) error {
			panic("mock out the PutNumberOfTasks method")
		},
		UnlockJobFunc: func(lockID string) error {
			panic("mock out the UnlockJob method")
		},
	}

	// use mockedJobStorer in code that requires api.JobStorer
	// and then make assertions.

}

func (*JobStorerMock) AcquireJobLock added in v0.5.0

func (mock *JobStorerMock) AcquireJobLock(ctx context.Context, id string) (string, error)

AcquireJobLock calls AcquireJobLockFunc.

func (*JobStorerMock) AcquireJobLockCalls added in v0.6.0

func (mock *JobStorerMock) AcquireJobLockCalls() []struct {
	Ctx context.Context
	ID  string
}

AcquireJobLockCalls gets all the calls that were made to AcquireJobLock. Check the length with:

len(mockedJobStorer.AcquireJobLockCalls())

func (*JobStorerMock) CreateJob added in v0.5.0

func (mock *JobStorerMock) CreateJob(ctx context.Context, id string) (job models.Job, err error)

CreateJob calls CreateJobFunc.

func (*JobStorerMock) CreateJobCalls added in v0.6.0

func (mock *JobStorerMock) CreateJobCalls() []struct {
	Ctx context.Context
	ID  string
}

CreateJobCalls gets all the calls that were made to CreateJob. Check the length with:

len(mockedJobStorer.CreateJobCalls())

func (*JobStorerMock) GetJob added in v0.5.0

func (mock *JobStorerMock) GetJob(ctx context.Context, id string) (job models.Job, err error)

GetJob calls GetJobFunc.

func (*JobStorerMock) GetJobCalls added in v0.6.0

func (mock *JobStorerMock) GetJobCalls() []struct {
	Ctx context.Context
	ID  string
}

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

len(mockedJobStorer.GetJobCalls())

func (*JobStorerMock) GetJobs added in v0.5.0

func (mock *JobStorerMock) GetJobs(ctx context.Context, offsetParam string, limitParam string) (job models.Jobs, err error)

GetJobs calls GetJobsFunc.

func (*JobStorerMock) GetJobsCalls added in v0.6.0

func (mock *JobStorerMock) GetJobsCalls() []struct {
	Ctx         context.Context
	OffsetParam string
	LimitParam  string
}

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

len(mockedJobStorer.GetJobsCalls())

func (*JobStorerMock) PutNumberOfTasks added in v0.6.0

func (mock *JobStorerMock) PutNumberOfTasks(ctx context.Context, id string, count int) error

PutNumberOfTasks calls PutNumberOfTasksFunc.

func (*JobStorerMock) PutNumberOfTasksCalls added in v0.6.0

func (mock *JobStorerMock) PutNumberOfTasksCalls() []struct {
	Ctx   context.Context
	ID    string
	Count int
}

PutNumberOfTasksCalls gets all the calls that were made to PutNumberOfTasks. Check the length with:

len(mockedJobStorer.PutNumberOfTasksCalls())

func (*JobStorerMock) UnlockJob added in v0.5.0

func (mock *JobStorerMock) UnlockJob(lockID string) error

UnlockJob calls UnlockJobFunc.

func (*JobStorerMock) UnlockJobCalls added in v0.6.0

func (mock *JobStorerMock) UnlockJobCalls() []struct {
	LockID string
}

UnlockJobCalls gets all the calls that were made to UnlockJob. Check the length with:

len(mockedJobStorer.UnlockJobCalls())

Jump to

Keyboard shortcuts

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