Documentation
¶
Index ¶
- type JobServiceMock
- func (mock *JobServiceMock) ClaimJob(ctx context.Context) (*domain.Job, error)
- func (mock *JobServiceMock) ClaimJobCalls() []struct{ ... }
- func (mock *JobServiceMock) ClaimTask(ctx context.Context) (*domain.Task, error)
- func (mock *JobServiceMock) ClaimTaskCalls() []struct{ ... }
- func (mock *JobServiceMock) CountEventsByJobNumber(ctx context.Context, jobNumber int) (int, error)
- func (mock *JobServiceMock) CountEventsByJobNumberCalls() []struct{ ... }
- func (mock *JobServiceMock) CountTasksByJobNumber(ctx context.Context, jobNumber int) (int, error)
- func (mock *JobServiceMock) CountTasksByJobNumberCalls() []struct{ ... }
- func (mock *JobServiceMock) CreateEvent(ctx context.Context, jobNumber int, event *domain.Event) (*domain.Event, error)
- func (mock *JobServiceMock) CreateEventCalls() []struct{ ... }
- func (mock *JobServiceMock) CreateJob(ctx context.Context, jobConfig *domain.JobConfig, userID string, ...) (*domain.Job, error)
- func (mock *JobServiceMock) CreateJobCalls() []struct{ ... }
- func (mock *JobServiceMock) CreateTask(ctx context.Context, jobNumber int, task *domain.Task) (*domain.Task, error)
- func (mock *JobServiceMock) CreateTaskCalls() []struct{ ... }
- func (mock *JobServiceMock) GetJob(ctx context.Context, jobNumber int) (*domain.Job, error)
- func (mock *JobServiceMock) GetJobCalls() []struct{ ... }
- func (mock *JobServiceMock) GetJobEvents(ctx context.Context, jobNumber int, limit int, offset int) ([]*domain.Event, int, error)
- func (mock *JobServiceMock) GetJobEventsCalls() []struct{ ... }
- func (mock *JobServiceMock) GetJobTasks(ctx context.Context, states []domain.State, jobNumber int, limit int, ...) ([]*domain.Task, int, error)
- func (mock *JobServiceMock) GetJobTasksCalls() []struct{ ... }
- func (mock *JobServiceMock) GetJobs(ctx context.Context, field sort.SortParameterField, ...) ([]*domain.Job, int, error)
- func (mock *JobServiceMock) GetJobsCalls() []struct{ ... }
- func (mock *JobServiceMock) GetNextJobNumber(ctx context.Context) (*domain.Counter, error)
- func (mock *JobServiceMock) GetNextJobNumberCalls() []struct{ ... }
- func (mock *JobServiceMock) UpdateJobState(ctx context.Context, jobNumber int, newState domain.State, userID string) error
- func (mock *JobServiceMock) UpdateJobStateCalls() []struct{ ... }
- func (mock *JobServiceMock) UpdateTask(ctx context.Context, task *domain.Task) error
- func (mock *JobServiceMock) UpdateTaskCalls() []struct{ ... }
- func (mock *JobServiceMock) UpdateTaskState(ctx context.Context, taskID string, newState domain.State) error
- func (mock *JobServiceMock) UpdateTaskStateCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobServiceMock ¶
type JobServiceMock struct {
// ClaimJobFunc mocks the ClaimJob method.
ClaimJobFunc func(ctx context.Context) (*domain.Job, error)
// ClaimTaskFunc mocks the ClaimTask method.
ClaimTaskFunc func(ctx context.Context) (*domain.Task, error)
// CountEventsByJobNumberFunc mocks the CountEventsByJobNumber method.
CountEventsByJobNumberFunc func(ctx context.Context, jobNumber int) (int, error)
// CountTasksByJobNumberFunc mocks the CountTasksByJobNumber method.
CountTasksByJobNumberFunc func(ctx context.Context, jobNumber int) (int, error)
// CreateEventFunc mocks the CreateEvent method.
CreateEventFunc func(ctx context.Context, jobNumber int, event *domain.Event) (*domain.Event, error)
// CreateJobFunc mocks the CreateJob method.
CreateJobFunc func(ctx context.Context, jobConfig *domain.JobConfig, userID string, userAuthToken string) (*domain.Job, error)
// CreateTaskFunc mocks the CreateTask method.
CreateTaskFunc func(ctx context.Context, jobNumber int, task *domain.Task) (*domain.Task, error)
// GetJobFunc mocks the GetJob method.
GetJobFunc func(ctx context.Context, jobNumber int) (*domain.Job, error)
// GetJobEventsFunc mocks the GetJobEvents method.
GetJobEventsFunc func(ctx context.Context, jobNumber int, limit int, offset int) ([]*domain.Event, int, error)
// GetJobTasksFunc mocks the GetJobTasks method.
GetJobTasksFunc func(ctx context.Context, states []domain.State, jobNumber int, limit int, offset int) ([]*domain.Task, int, error)
// GetJobsFunc mocks the GetJobs method.
GetJobsFunc func(ctx context.Context, field sort.SortParameterField, direction sort.SortParameterDirection, states []domain.State, limit int, offset int) ([]*domain.Job, int, error)
// GetNextJobNumberFunc mocks the GetNextJobNumber method.
GetNextJobNumberFunc func(ctx context.Context) (*domain.Counter, error)
// UpdateJobStateFunc mocks the UpdateJobState method.
UpdateJobStateFunc func(ctx context.Context, jobNumber int, newState domain.State, userID string) error
// UpdateTaskFunc mocks the UpdateTask method.
UpdateTaskFunc func(ctx context.Context, task *domain.Task) error
// UpdateTaskStateFunc mocks the UpdateTaskState method.
UpdateTaskStateFunc func(ctx context.Context, taskID string, newState domain.State) error
// contains filtered or unexported fields
}
JobServiceMock is a mock implementation of application.JobService.
func TestSomethingThatUsesJobService(t *testing.T) {
// make and configure a mocked application.JobService
mockedJobService := &JobServiceMock{
ClaimJobFunc: func(ctx context.Context) (*domain.Job, error) {
panic("mock out the ClaimJob method")
},
ClaimTaskFunc: func(ctx context.Context) (*domain.Task, error) {
panic("mock out the ClaimTask method")
},
CountEventsByJobNumberFunc: func(ctx context.Context, jobNumber int) (int, error) {
panic("mock out the CountEventsByJobNumber method")
},
CountTasksByJobNumberFunc: func(ctx context.Context, jobNumber int) (int, error) {
panic("mock out the CountTasksByJobNumber method")
},
CreateEventFunc: func(ctx context.Context, jobNumber int, event *domain.Event) (*domain.Event, error) {
panic("mock out the CreateEvent method")
},
CreateJobFunc: func(ctx context.Context, jobConfig *domain.JobConfig, userID string, userAuthToken string) (*domain.Job, error) {
panic("mock out the CreateJob method")
},
CreateTaskFunc: func(ctx context.Context, jobNumber int, task *domain.Task) (*domain.Task, error) {
panic("mock out the CreateTask method")
},
GetJobFunc: func(ctx context.Context, jobNumber int) (*domain.Job, error) {
panic("mock out the GetJob method")
},
GetJobEventsFunc: func(ctx context.Context, jobNumber int, limit int, offset int) ([]*domain.Event, int, error) {
panic("mock out the GetJobEvents method")
},
GetJobTasksFunc: func(ctx context.Context, states []domain.State, jobNumber int, limit int, offset int) ([]*domain.Task, int, error) {
panic("mock out the GetJobTasks method")
},
GetJobsFunc: func(ctx context.Context, field sort.SortParameterField, direction sort.SortParameterDirection, states []domain.State, limit int, offset int) ([]*domain.Job, int, error) {
panic("mock out the GetJobs method")
},
GetNextJobNumberFunc: func(ctx context.Context) (*domain.Counter, error) {
panic("mock out the GetNextJobNumber method")
},
UpdateJobStateFunc: func(ctx context.Context, jobNumber int, newState domain.State, userID string) error {
panic("mock out the UpdateJobState method")
},
UpdateTaskFunc: func(ctx context.Context, task *domain.Task) error {
panic("mock out the UpdateTask method")
},
UpdateTaskStateFunc: func(ctx context.Context, taskID string, newState domain.State) error {
panic("mock out the UpdateTaskState method")
},
}
// use mockedJobService in code that requires application.JobService
// and then make assertions.
}
func (*JobServiceMock) ClaimJobCalls ¶ added in v0.15.0
func (mock *JobServiceMock) ClaimJobCalls() []struct { Ctx context.Context }
ClaimJobCalls gets all the calls that were made to ClaimJob. Check the length with:
len(mockedJobService.ClaimJobCalls())
func (*JobServiceMock) ClaimTaskCalls ¶ added in v0.15.0
func (mock *JobServiceMock) ClaimTaskCalls() []struct { Ctx context.Context }
ClaimTaskCalls gets all the calls that were made to ClaimTask. Check the length with:
len(mockedJobService.ClaimTaskCalls())
func (*JobServiceMock) CountEventsByJobNumber ¶ added in v0.19.0
CountEventsByJobNumber calls CountEventsByJobNumberFunc.
func (*JobServiceMock) CountEventsByJobNumberCalls ¶ added in v0.19.0
func (mock *JobServiceMock) CountEventsByJobNumberCalls() []struct { Ctx context.Context JobNumber int }
CountEventsByJobNumberCalls gets all the calls that were made to CountEventsByJobNumber. Check the length with:
len(mockedJobService.CountEventsByJobNumberCalls())
func (*JobServiceMock) CountTasksByJobNumber ¶ added in v0.19.0
CountTasksByJobNumber calls CountTasksByJobNumberFunc.
func (*JobServiceMock) CountTasksByJobNumberCalls ¶ added in v0.19.0
func (mock *JobServiceMock) CountTasksByJobNumberCalls() []struct { Ctx context.Context JobNumber int }
CountTasksByJobNumberCalls gets all the calls that were made to CountTasksByJobNumber. Check the length with:
len(mockedJobService.CountTasksByJobNumberCalls())
func (*JobServiceMock) CreateEvent ¶ added in v0.12.0
func (mock *JobServiceMock) CreateEvent(ctx context.Context, jobNumber int, event *domain.Event) (*domain.Event, error)
CreateEvent calls CreateEventFunc.
func (*JobServiceMock) CreateEventCalls ¶ added in v0.12.0
func (mock *JobServiceMock) CreateEventCalls() []struct { Ctx context.Context JobNumber int Event *domain.Event }
CreateEventCalls gets all the calls that were made to CreateEvent. Check the length with:
len(mockedJobService.CreateEventCalls())
func (*JobServiceMock) CreateJob ¶
func (mock *JobServiceMock) CreateJob(ctx context.Context, jobConfig *domain.JobConfig, userID string, userAuthToken string) (*domain.Job, error)
CreateJob calls CreateJobFunc.
func (*JobServiceMock) CreateJobCalls ¶
func (mock *JobServiceMock) CreateJobCalls() []struct { Ctx context.Context JobConfig *domain.JobConfig UserID string UserAuthToken string }
CreateJobCalls gets all the calls that were made to CreateJob. Check the length with:
len(mockedJobService.CreateJobCalls())
func (*JobServiceMock) CreateTask ¶ added in v0.12.0
func (mock *JobServiceMock) CreateTask(ctx context.Context, jobNumber int, task *domain.Task) (*domain.Task, error)
CreateTask calls CreateTaskFunc.
func (*JobServiceMock) CreateTaskCalls ¶ added in v0.12.0
func (mock *JobServiceMock) CreateTaskCalls() []struct { Ctx context.Context JobNumber int Task *domain.Task }
CreateTaskCalls gets all the calls that were made to CreateTask. Check the length with:
len(mockedJobService.CreateTaskCalls())
func (*JobServiceMock) GetJobCalls ¶
func (mock *JobServiceMock) GetJobCalls() []struct { Ctx context.Context JobNumber int }
GetJobCalls gets all the calls that were made to GetJob. Check the length with:
len(mockedJobService.GetJobCalls())
func (*JobServiceMock) GetJobEvents ¶ added in v0.12.0
func (mock *JobServiceMock) GetJobEvents(ctx context.Context, jobNumber int, limit int, offset int) ([]*domain.Event, int, error)
GetJobEvents calls GetJobEventsFunc.
func (*JobServiceMock) GetJobEventsCalls ¶ added in v0.12.0
func (mock *JobServiceMock) GetJobEventsCalls() []struct { Ctx context.Context JobNumber int Limit int Offset int }
GetJobEventsCalls gets all the calls that were made to GetJobEvents. Check the length with:
len(mockedJobService.GetJobEventsCalls())
func (*JobServiceMock) GetJobTasks ¶ added in v0.11.0
func (mock *JobServiceMock) GetJobTasks(ctx context.Context, states []domain.State, jobNumber int, limit int, offset int) ([]*domain.Task, int, error)
GetJobTasks calls GetJobTasksFunc.
func (*JobServiceMock) GetJobTasksCalls ¶ added in v0.11.0
func (mock *JobServiceMock) GetJobTasksCalls() []struct { Ctx context.Context States []domain.State JobNumber int Limit int Offset int }
GetJobTasksCalls gets all the calls that were made to GetJobTasks. Check the length with:
len(mockedJobService.GetJobTasksCalls())
func (*JobServiceMock) GetJobs ¶ added in v0.10.0
func (mock *JobServiceMock) GetJobs(ctx context.Context, field sort.SortParameterField, direction sort.SortParameterDirection, states []domain.State, limit int, offset int) ([]*domain.Job, int, error)
GetJobs calls GetJobsFunc.
func (*JobServiceMock) GetJobsCalls ¶ added in v0.10.0
func (mock *JobServiceMock) GetJobsCalls() []struct { Ctx context.Context Field sort.SortParameterField Direction sort.SortParameterDirection States []domain.State Limit int Offset int }
GetJobsCalls gets all the calls that were made to GetJobs. Check the length with:
len(mockedJobService.GetJobsCalls())
func (*JobServiceMock) GetNextJobNumber ¶ added in v0.19.0
GetNextJobNumber calls GetNextJobNumberFunc.
func (*JobServiceMock) GetNextJobNumberCalls ¶ added in v0.19.0
func (mock *JobServiceMock) GetNextJobNumberCalls() []struct { Ctx context.Context }
GetNextJobNumberCalls gets all the calls that were made to GetNextJobNumber. Check the length with:
len(mockedJobService.GetNextJobNumberCalls())
func (*JobServiceMock) UpdateJobState ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateJobState(ctx context.Context, jobNumber int, newState domain.State, userID string) error
UpdateJobState calls UpdateJobStateFunc.
func (*JobServiceMock) UpdateJobStateCalls ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateJobStateCalls() []struct { Ctx context.Context JobNumber int NewState domain.State UserID string }
UpdateJobStateCalls gets all the calls that were made to UpdateJobState. Check the length with:
len(mockedJobService.UpdateJobStateCalls())
func (*JobServiceMock) UpdateTask ¶ added in v0.15.0
UpdateTask calls UpdateTaskFunc.
func (*JobServiceMock) UpdateTaskCalls ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateTaskCalls() []struct { Ctx context.Context Task *domain.Task }
UpdateTaskCalls gets all the calls that were made to UpdateTask. Check the length with:
len(mockedJobService.UpdateTaskCalls())
func (*JobServiceMock) UpdateTaskState ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateTaskState(ctx context.Context, taskID string, newState domain.State) error
UpdateTaskState calls UpdateTaskStateFunc.
func (*JobServiceMock) UpdateTaskStateCalls ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateTaskStateCalls() []struct { Ctx context.Context TaskID string NewState domain.State }
UpdateTaskStateCalls gets all the calls that were made to UpdateTaskState. Check the length with:
len(mockedJobService.UpdateTaskStateCalls())