mock

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 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 DataStorerMock

type DataStorerMock struct {
	// AcquireInstanceLockFunc mocks the AcquireInstanceLock method.
	AcquireInstanceLockFunc func(ctx context.Context, jobID string) (string, error)

	// AddJobFunc mocks the AddJob method.
	AddJobFunc func(ctx context.Context, importJob *models.Job) (*models.Job, error)

	// AddUploadedFileFunc mocks the AddUploadedFile method.
	AddUploadedFileFunc func(ctx context.Context, jobID string, message *models.UploadedFile) error

	// CheckerFunc mocks the Checker method.
	CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

	// CloseFunc mocks the Close method.
	CloseFunc func(contextMoqParam context.Context) error

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

	// GetJobsFunc mocks the GetJobs method.
	GetJobsFunc func(ctx context.Context, filters []string, offset int, limit int) (*models.JobResults, error)

	// UnlockInstanceFunc mocks the UnlockInstance method.
	UnlockInstanceFunc func(ctx context.Context, lockID string)

	// UpdateJobFunc mocks the UpdateJob method.
	UpdateJobFunc func(ctx context.Context, jobID string, update *models.Job) error

	// UpdateProcessedInstanceFunc mocks the UpdateProcessedInstance method.
	UpdateProcessedInstanceFunc func(ctx context.Context, id string, procInstances []models.ProcessedInstances) error
	// contains filtered or unexported fields
}

DataStorerMock is a mock implementation of datastore.DataStorer.

func TestSomethingThatUsesDataStorer(t *testing.T) {

	// make and configure a mocked datastore.DataStorer
	mockedDataStorer := &DataStorerMock{
		AcquireInstanceLockFunc: func(ctx context.Context, jobID string) (string, error) {
			panic("mock out the AcquireInstanceLock method")
		},
		AddJobFunc: func(ctx context.Context, importJob *models.Job) (*models.Job, error) {
			panic("mock out the AddJob method")
		},
		AddUploadedFileFunc: func(ctx context.Context, jobID string, message *models.UploadedFile) error {
			panic("mock out the AddUploadedFile method")
		},
		CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		CloseFunc: func(contextMoqParam context.Context) error {
			panic("mock out the Close method")
		},
		GetJobFunc: func(ctx context.Context, jobID string) (*models.Job, error) {
			panic("mock out the GetJob method")
		},
		GetJobsFunc: func(ctx context.Context, filters []string, offset int, limit int) (*models.JobResults, error) {
			panic("mock out the GetJobs method")
		},
		UnlockInstanceFunc: func(ctx context.Context, lockID string)  {
			panic("mock out the UnlockInstance method")
		},
		UpdateJobFunc: func(ctx context.Context, jobID string, update *models.Job) error {
			panic("mock out the UpdateJob method")
		},
		UpdateProcessedInstanceFunc: func(ctx context.Context, id string, procInstances []models.ProcessedInstances) error {
			panic("mock out the UpdateProcessedInstance method")
		},
	}

	// use mockedDataStorer in code that requires datastore.DataStorer
	// and then make assertions.

}

func (*DataStorerMock) AcquireInstanceLock added in v1.18.0

func (mock *DataStorerMock) AcquireInstanceLock(ctx context.Context, jobID string) (string, error)

AcquireInstanceLock calls AcquireInstanceLockFunc.

func (*DataStorerMock) AcquireInstanceLockCalls added in v1.18.0

func (mock *DataStorerMock) AcquireInstanceLockCalls() []struct {
	Ctx   context.Context
	JobID string
}

AcquireInstanceLockCalls gets all the calls that were made to AcquireInstanceLock. Check the length with:

len(mockedDataStorer.AcquireInstanceLockCalls())

func (*DataStorerMock) AddJob

func (mock *DataStorerMock) AddJob(ctx context.Context, importJob *models.Job) (*models.Job, error)

AddJob calls AddJobFunc.

func (*DataStorerMock) AddJobCalls

func (mock *DataStorerMock) AddJobCalls() []struct {
	Ctx       context.Context
	ImportJob *models.Job
}

AddJobCalls gets all the calls that were made to AddJob. Check the length with:

len(mockedDataStorer.AddJobCalls())

func (*DataStorerMock) AddUploadedFile

func (mock *DataStorerMock) AddUploadedFile(ctx context.Context, jobID string, message *models.UploadedFile) error

AddUploadedFile calls AddUploadedFileFunc.

func (*DataStorerMock) AddUploadedFileCalls

func (mock *DataStorerMock) AddUploadedFileCalls() []struct {
	Ctx     context.Context
	JobID   string
	Message *models.UploadedFile
}

AddUploadedFileCalls gets all the calls that were made to AddUploadedFile. Check the length with:

len(mockedDataStorer.AddUploadedFileCalls())

func (*DataStorerMock) Checker

func (mock *DataStorerMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*DataStorerMock) CheckerCalls

func (mock *DataStorerMock) CheckerCalls() []struct {
	ContextMoqParam context.Context
	CheckState      *healthcheck.CheckState
}

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

len(mockedDataStorer.CheckerCalls())

func (*DataStorerMock) Close

func (mock *DataStorerMock) Close(contextMoqParam context.Context) error

Close calls CloseFunc.

func (*DataStorerMock) CloseCalls

func (mock *DataStorerMock) CloseCalls() []struct {
	ContextMoqParam context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedDataStorer.CloseCalls())

func (*DataStorerMock) GetJob

func (mock *DataStorerMock) GetJob(ctx context.Context, jobID string) (*models.Job, error)

GetJob calls GetJobFunc.

func (*DataStorerMock) GetJobCalls

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

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

len(mockedDataStorer.GetJobCalls())

func (*DataStorerMock) GetJobs

func (mock *DataStorerMock) GetJobs(ctx context.Context, filters []string, offset int, limit int) (*models.JobResults, error)

GetJobs calls GetJobsFunc.

func (*DataStorerMock) GetJobsCalls

func (mock *DataStorerMock) GetJobsCalls() []struct {
	Ctx     context.Context
	Filters []string
	Offset  int
	Limit   int
}

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

len(mockedDataStorer.GetJobsCalls())

func (*DataStorerMock) UnlockInstance added in v1.18.0

func (mock *DataStorerMock) UnlockInstance(ctx context.Context, lockID string)

UnlockInstance calls UnlockInstanceFunc.

func (*DataStorerMock) UnlockInstanceCalls added in v1.18.0

func (mock *DataStorerMock) UnlockInstanceCalls() []struct {
	Ctx    context.Context
	LockID string
}

UnlockInstanceCalls gets all the calls that were made to UnlockInstance. Check the length with:

len(mockedDataStorer.UnlockInstanceCalls())

func (*DataStorerMock) UpdateJob

func (mock *DataStorerMock) UpdateJob(ctx context.Context, jobID string, update *models.Job) error

UpdateJob calls UpdateJobFunc.

func (*DataStorerMock) UpdateJobCalls

func (mock *DataStorerMock) UpdateJobCalls() []struct {
	Ctx    context.Context
	JobID  string
	Update *models.Job
}

UpdateJobCalls gets all the calls that were made to UpdateJob. Check the length with:

len(mockedDataStorer.UpdateJobCalls())

func (*DataStorerMock) UpdateProcessedInstance added in v1.18.0

func (mock *DataStorerMock) UpdateProcessedInstance(ctx context.Context, id string, procInstances []models.ProcessedInstances) error

UpdateProcessedInstance calls UpdateProcessedInstanceFunc.

func (*DataStorerMock) UpdateProcessedInstanceCalls added in v1.18.0

func (mock *DataStorerMock) UpdateProcessedInstanceCalls() []struct {
	Ctx           context.Context
	ID            string
	ProcInstances []models.ProcessedInstances
}

UpdateProcessedInstanceCalls gets all the calls that were made to UpdateProcessedInstance. Check the length with:

len(mockedDataStorer.UpdateProcessedInstanceCalls())

Jump to

Keyboard shortcuts

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