mocks

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 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 CronMock added in v0.4.0

type CronMock struct {
	// EntriesFunc mocks the Entries method.
	EntriesFunc func() []cron.Entry

	// RemoveFunc mocks the Remove method.
	RemoveFunc func(id cron.EntryID)

	// ScheduleFunc mocks the Schedule method.
	ScheduleFunc func(schedule cron.Schedule, cmd cron.Job) cron.EntryID

	// StartFunc mocks the Start method.
	StartFunc func()

	// StopFunc mocks the Stop method.
	StopFunc func() context.Context
	// contains filtered or unexported fields
}

CronMock is a mock implementation of service.Cron.

func TestSomethingThatUsesCron(t *testing.T) {

	// make and configure a mocked service.Cron
	mockedCron := &CronMock{
		EntriesFunc: func() []cron.Entry {
			panic("mock out the Entries method")
		},
		RemoveFunc: func(id cron.EntryID)  {
			panic("mock out the Remove method")
		},
		ScheduleFunc: func(schedule cron.Schedule, cmd cron.Job) cron.EntryID {
			panic("mock out the Schedule method")
		},
		StartFunc: func()  {
			panic("mock out the Start method")
		},
		StopFunc: func() context.Context {
			panic("mock out the Stop method")
		},
	}

	// use mockedCron in code that requires service.Cron
	// and then make assertions.

}

func (*CronMock) Entries added in v0.4.0

func (mock *CronMock) Entries() []cron.Entry

Entries calls EntriesFunc.

func (*CronMock) EntriesCalls added in v0.4.0

func (mock *CronMock) EntriesCalls() []struct {
}

EntriesCalls gets all the calls that were made to Entries. Check the length with:

len(mockedCron.EntriesCalls())

func (*CronMock) Remove added in v0.4.0

func (mock *CronMock) Remove(id cron.EntryID)

Remove calls RemoveFunc.

func (*CronMock) RemoveCalls added in v0.4.0

func (mock *CronMock) RemoveCalls() []struct {
	ID cron.EntryID
}

RemoveCalls gets all the calls that were made to Remove. Check the length with:

len(mockedCron.RemoveCalls())

func (*CronMock) Schedule added in v0.4.0

func (mock *CronMock) Schedule(schedule cron.Schedule, cmd cron.Job) cron.EntryID

Schedule calls ScheduleFunc.

func (*CronMock) ScheduleCalls added in v0.4.0

func (mock *CronMock) ScheduleCalls() []struct {
	Schedule cron.Schedule
	Cmd      cron.Job
}

ScheduleCalls gets all the calls that were made to Schedule. Check the length with:

len(mockedCron.ScheduleCalls())

func (*CronMock) Start added in v0.4.0

func (mock *CronMock) Start()

Start calls StartFunc.

func (*CronMock) StartCalls added in v0.4.0

func (mock *CronMock) StartCalls() []struct {
}

StartCalls gets all the calls that were made to Start. Check the length with:

len(mockedCron.StartCalls())

func (*CronMock) Stop added in v0.4.0

func (mock *CronMock) Stop() context.Context

Stop calls StopFunc.

func (*CronMock) StopCalls added in v0.4.0

func (mock *CronMock) StopCalls() []struct {
}

StopCalls gets all the calls that were made to Stop. Check the length with:

len(mockedCron.StopCalls())

type CrontabParserMock added in v0.4.0

type CrontabParserMock struct {
	// ChangesFunc mocks the Changes method.
	ChangesFunc func(ctx context.Context) (<-chan []crontab.JobSpec, error)

	// ListFunc mocks the List method.
	ListFunc func() ([]crontab.JobSpec, error)

	// StringFunc mocks the String method.
	StringFunc func() string
	// contains filtered or unexported fields
}

CrontabParserMock is a mock implementation of service.CrontabParser.

func TestSomethingThatUsesCrontabParser(t *testing.T) {

	// make and configure a mocked service.CrontabParser
	mockedCrontabParser := &CrontabParserMock{
		ChangesFunc: func(ctx context.Context) (<-chan []crontab.JobSpec, error) {
			panic("mock out the Changes method")
		},
		ListFunc: func() ([]crontab.JobSpec, error) {
			panic("mock out the List method")
		},
		StringFunc: func() string {
			panic("mock out the String method")
		},
	}

	// use mockedCrontabParser in code that requires service.CrontabParser
	// and then make assertions.

}

func (*CrontabParserMock) Changes added in v0.4.0

func (mock *CrontabParserMock) Changes(ctx context.Context) (<-chan []crontab.JobSpec, error)

Changes calls ChangesFunc.

func (*CrontabParserMock) ChangesCalls added in v0.4.0

func (mock *CrontabParserMock) ChangesCalls() []struct {
	Ctx context.Context
}

ChangesCalls gets all the calls that were made to Changes. Check the length with:

len(mockedCrontabParser.ChangesCalls())

func (*CrontabParserMock) List added in v0.4.0

func (mock *CrontabParserMock) List() ([]crontab.JobSpec, error)

List calls ListFunc.

func (*CrontabParserMock) ListCalls added in v0.4.0

func (mock *CrontabParserMock) ListCalls() []struct {
}

ListCalls gets all the calls that were made to List. Check the length with:

len(mockedCrontabParser.ListCalls())

func (*CrontabParserMock) String added in v0.4.0

func (mock *CrontabParserMock) String() string

String calls StringFunc.

func (*CrontabParserMock) StringCalls added in v0.4.0

func (mock *CrontabParserMock) StringCalls() []struct {
}

StringCalls gets all the calls that were made to String. Check the length with:

len(mockedCrontabParser.StringCalls())

type DedupperMock added in v0.4.0

type DedupperMock struct {
	// AddFunc mocks the Add method.
	AddFunc func(key string) bool

	// RemoveFunc mocks the Remove method.
	RemoveFunc func(key string)
	// contains filtered or unexported fields
}

DedupperMock is a mock implementation of service.Dedupper.

func TestSomethingThatUsesDedupper(t *testing.T) {

	// make and configure a mocked service.Dedupper
	mockedDedupper := &DedupperMock{
		AddFunc: func(key string) bool {
			panic("mock out the Add method")
		},
		RemoveFunc: func(key string)  {
			panic("mock out the Remove method")
		},
	}

	// use mockedDedupper in code that requires service.Dedupper
	// and then make assertions.

}

func (*DedupperMock) Add added in v0.4.0

func (mock *DedupperMock) Add(key string) bool

Add calls AddFunc.

func (*DedupperMock) AddCalls added in v0.4.0

func (mock *DedupperMock) AddCalls() []struct {
	Key string
}

AddCalls gets all the calls that were made to Add. Check the length with:

len(mockedDedupper.AddCalls())

func (*DedupperMock) Remove added in v0.4.0

func (mock *DedupperMock) Remove(key string)

Remove calls RemoveFunc.

func (*DedupperMock) RemoveCalls added in v0.4.0

func (mock *DedupperMock) RemoveCalls() []struct {
	Key string
}

RemoveCalls gets all the calls that were made to Remove. Check the length with:

len(mockedDedupper.RemoveCalls())

type NotifierMock added in v0.4.0

type NotifierMock struct {
	// IsOnCompletionFunc mocks the IsOnCompletion method.
	IsOnCompletionFunc func() bool

	// IsOnErrorFunc mocks the IsOnError method.
	IsOnErrorFunc func() bool

	// MakeCompletionHTMLFunc mocks the MakeCompletionHTML method.
	MakeCompletionHTMLFunc func(spec string, command string) (string, error)

	// MakeErrorHTMLFunc mocks the MakeErrorHTML method.
	MakeErrorHTMLFunc func(spec string, command string, errorLog string) (string, error)

	// SendFunc mocks the Send method.
	SendFunc func(ctx context.Context, subj string, text string) error
	// contains filtered or unexported fields
}

NotifierMock is a mock implementation of service.Notifier.

func TestSomethingThatUsesNotifier(t *testing.T) {

	// make and configure a mocked service.Notifier
	mockedNotifier := &NotifierMock{
		IsOnCompletionFunc: func() bool {
			panic("mock out the IsOnCompletion method")
		},
		IsOnErrorFunc: func() bool {
			panic("mock out the IsOnError method")
		},
		MakeCompletionHTMLFunc: func(spec string, command string) (string, error) {
			panic("mock out the MakeCompletionHTML method")
		},
		MakeErrorHTMLFunc: func(spec string, command string, errorLog string) (string, error) {
			panic("mock out the MakeErrorHTML method")
		},
		SendFunc: func(ctx context.Context, subj string, text string) error {
			panic("mock out the Send method")
		},
	}

	// use mockedNotifier in code that requires service.Notifier
	// and then make assertions.

}

func (*NotifierMock) IsOnCompletion added in v0.4.0

func (mock *NotifierMock) IsOnCompletion() bool

IsOnCompletion calls IsOnCompletionFunc.

func (*NotifierMock) IsOnCompletionCalls added in v0.4.0

func (mock *NotifierMock) IsOnCompletionCalls() []struct {
}

IsOnCompletionCalls gets all the calls that were made to IsOnCompletion. Check the length with:

len(mockedNotifier.IsOnCompletionCalls())

func (*NotifierMock) IsOnError added in v0.4.0

func (mock *NotifierMock) IsOnError() bool

IsOnError calls IsOnErrorFunc.

func (*NotifierMock) IsOnErrorCalls added in v0.4.0

func (mock *NotifierMock) IsOnErrorCalls() []struct {
}

IsOnErrorCalls gets all the calls that were made to IsOnError. Check the length with:

len(mockedNotifier.IsOnErrorCalls())

func (*NotifierMock) MakeCompletionHTML added in v0.4.0

func (mock *NotifierMock) MakeCompletionHTML(spec string, command string) (string, error)

MakeCompletionHTML calls MakeCompletionHTMLFunc.

func (*NotifierMock) MakeCompletionHTMLCalls added in v0.4.0

func (mock *NotifierMock) MakeCompletionHTMLCalls() []struct {
	Spec    string
	Command string
}

MakeCompletionHTMLCalls gets all the calls that were made to MakeCompletionHTML. Check the length with:

len(mockedNotifier.MakeCompletionHTMLCalls())

func (*NotifierMock) MakeErrorHTML added in v0.4.0

func (mock *NotifierMock) MakeErrorHTML(spec string, command string, errorLog string) (string, error)

MakeErrorHTML calls MakeErrorHTMLFunc.

func (*NotifierMock) MakeErrorHTMLCalls added in v0.4.0

func (mock *NotifierMock) MakeErrorHTMLCalls() []struct {
	Spec     string
	Command  string
	ErrorLog string
}

MakeErrorHTMLCalls gets all the calls that were made to MakeErrorHTML. Check the length with:

len(mockedNotifier.MakeErrorHTMLCalls())

func (*NotifierMock) Send added in v0.4.0

func (mock *NotifierMock) Send(ctx context.Context, subj string, text string) error

Send calls SendFunc.

func (*NotifierMock) SendCalls added in v0.4.0

func (mock *NotifierMock) SendCalls() []struct {
	Ctx  context.Context
	Subj string
	Text string
}

SendCalls gets all the calls that were made to Send. Check the length with:

len(mockedNotifier.SendCalls())

type RepeaterMock added in v0.4.0

type RepeaterMock struct {
	// DoFunc mocks the Do method.
	DoFunc func(ctx context.Context, fun func() error, errors ...error) error
	// contains filtered or unexported fields
}

RepeaterMock is a mock implementation of service.Repeater.

func TestSomethingThatUsesRepeater(t *testing.T) {

	// make and configure a mocked service.Repeater
	mockedRepeater := &RepeaterMock{
		DoFunc: func(ctx context.Context, fun func() error, errors ...error) error {
			panic("mock out the Do method")
		},
	}

	// use mockedRepeater in code that requires service.Repeater
	// and then make assertions.

}

func (*RepeaterMock) Do added in v0.4.0

func (mock *RepeaterMock) Do(ctx context.Context, fun func() error, errors ...error) error

Do calls DoFunc.

func (*RepeaterMock) DoCalls added in v0.4.0

func (mock *RepeaterMock) DoCalls() []struct {
	Ctx    context.Context
	Fun    func() error
	Errors []error
}

DoCalls gets all the calls that were made to Do. Check the length with:

len(mockedRepeater.DoCalls())

type ResumerMock added in v0.4.0

type ResumerMock struct {
	// ListFunc mocks the List method.
	ListFunc func() []resumer.Cmd

	// OnFinishFunc mocks the OnFinish method.
	OnFinishFunc func(fname string) error

	// OnStartFunc mocks the OnStart method.
	OnStartFunc func(cmd string) (string, error)

	// StringFunc mocks the String method.
	StringFunc func() string
	// contains filtered or unexported fields
}

ResumerMock is a mock implementation of service.Resumer.

func TestSomethingThatUsesResumer(t *testing.T) {

	// make and configure a mocked service.Resumer
	mockedResumer := &ResumerMock{
		ListFunc: func() []resumer.Cmd {
			panic("mock out the List method")
		},
		OnFinishFunc: func(fname string) error {
			panic("mock out the OnFinish method")
		},
		OnStartFunc: func(cmd string) (string, error) {
			panic("mock out the OnStart method")
		},
		StringFunc: func() string {
			panic("mock out the String method")
		},
	}

	// use mockedResumer in code that requires service.Resumer
	// and then make assertions.

}

func (*ResumerMock) List added in v0.4.0

func (mock *ResumerMock) List() []resumer.Cmd

List calls ListFunc.

func (*ResumerMock) ListCalls added in v0.4.0

func (mock *ResumerMock) ListCalls() []struct {
}

ListCalls gets all the calls that were made to List. Check the length with:

len(mockedResumer.ListCalls())

func (*ResumerMock) OnFinish added in v0.4.0

func (mock *ResumerMock) OnFinish(fname string) error

OnFinish calls OnFinishFunc.

func (*ResumerMock) OnFinishCalls added in v0.4.0

func (mock *ResumerMock) OnFinishCalls() []struct {
	Fname string
}

OnFinishCalls gets all the calls that were made to OnFinish. Check the length with:

len(mockedResumer.OnFinishCalls())

func (*ResumerMock) OnStart added in v0.4.0

func (mock *ResumerMock) OnStart(cmd string) (string, error)

OnStart calls OnStartFunc.

func (*ResumerMock) OnStartCalls added in v0.4.0

func (mock *ResumerMock) OnStartCalls() []struct {
	Cmd string
}

OnStartCalls gets all the calls that were made to OnStart. Check the length with:

len(mockedResumer.OnStartCalls())

func (*ResumerMock) String added in v0.4.0

func (mock *ResumerMock) String() string

String calls StringFunc.

func (*ResumerMock) StringCalls added in v0.4.0

func (mock *ResumerMock) StringCalls() []struct {
}

StringCalls gets all the calls that were made to String. Check the length with:

len(mockedResumer.StringCalls())

type ScheduleMock added in v0.4.0

type ScheduleMock struct {
	// NextFunc mocks the Next method.
	NextFunc func(timeMoqParam time.Time) time.Time
	// contains filtered or unexported fields
}

ScheduleMock is a mock implementation of service.Schedule.

func TestSomethingThatUsesSchedule(t *testing.T) {

	// make and configure a mocked service.Schedule
	mockedSchedule := &ScheduleMock{
		NextFunc: func(timeMoqParam time.Time) time.Time {
			panic("mock out the Next method")
		},
	}

	// use mockedSchedule in code that requires service.Schedule
	// and then make assertions.

}

func (*ScheduleMock) Next added in v0.4.0

func (mock *ScheduleMock) Next(timeMoqParam time.Time) time.Time

Next calls NextFunc.

func (*ScheduleMock) NextCalls added in v0.4.0

func (mock *ScheduleMock) NextCalls() []struct {
	TimeMoqParam time.Time
}

NextCalls gets all the calls that were made to Next. Check the length with:

len(mockedSchedule.NextCalls())

Jump to

Keyboard shortcuts

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