mock

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 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 DataStorerMock

type DataStorerMock struct {
	// AddJobFunc mocks the AddJob method.
	AddJobFunc func(importJob *models.Job) (*models.Job, error)

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

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

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

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

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

	// UpdateJobFunc mocks the UpdateJob method.
	UpdateJobFunc func(jobID string, update *models.Job) 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{
            AddJobFunc: func(importJob *models.Job) (*models.Job, error) {
	               panic("mock out the AddJob method")
            },
            AddUploadedFileFunc: func(jobID string, message *models.UploadedFile) error {
	               panic("mock out the AddUploadedFile method")
            },
            CheckerFunc: func(in1 context.Context, in2 *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            CloseFunc: func(in1 context.Context) error {
	               panic("mock out the Close method")
            },
            GetJobFunc: func(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")
            },
            UpdateJobFunc: func(jobID string, update *models.Job) error {
	               panic("mock out the UpdateJob method")
            },
        }

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

    }

func (*DataStorerMock) AddJob

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

AddJob calls AddJobFunc.

func (*DataStorerMock) AddJobCalls

func (mock *DataStorerMock) AddJobCalls() []struct {
	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(jobID string, message *models.UploadedFile) error

AddUploadedFile calls AddUploadedFileFunc.

func (*DataStorerMock) AddUploadedFileCalls

func (mock *DataStorerMock) AddUploadedFileCalls() []struct {
	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(in1 context.Context, in2 *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*DataStorerMock) CheckerCalls

func (mock *DataStorerMock) CheckerCalls() []struct {
	In1 context.Context
	In2 *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(in1 context.Context) error

Close calls CloseFunc.

func (*DataStorerMock) CloseCalls

func (mock *DataStorerMock) CloseCalls() []struct {
	In1 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(jobID string) (*models.Job, error)

GetJob calls GetJobFunc.

func (*DataStorerMock) GetJobCalls

func (mock *DataStorerMock) GetJobCalls() []struct {
	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) UpdateJob

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

UpdateJob calls UpdateJobFunc.

func (*DataStorerMock) UpdateJobCalls

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

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

len(mockedDataStorer.UpdateJobCalls())

Jump to

Keyboard shortcuts

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