Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigMock ¶
type ConfigMock struct { // GetTaskCommandFunc mocks the GetTaskCommand method. GetTaskCommandFunc func(name string) (string, bool) // contains filtered or unexported fields }
ConfigMock is a mock implementation of server.Config.
func TestSomethingThatUsesConfig(t *testing.T) { // make and configure a mocked server.Config mockedConfig := &ConfigMock{ GetTaskCommandFunc: func(name string) (string, bool) { panic("mock out the GetTaskCommand method") }, } // use mockedConfig in code that requires server.Config // and then make assertions. }
func (*ConfigMock) GetTaskCommand ¶
func (mock *ConfigMock) GetTaskCommand(name string) (string, bool)
GetTaskCommand calls GetTaskCommandFunc.
func (*ConfigMock) GetTaskCommandCalls ¶
func (mock *ConfigMock) GetTaskCommandCalls() []struct { Name string }
GetTaskCommandCalls gets all the calls that were made to GetTaskCommand. Check the length with:
len(mockedConfig.GetTaskCommandCalls())
type RunnerMock ¶
type RunnerMock struct { // RunFunc mocks the Run method. RunFunc func(ctx context.Context, command string, logWriter io.Writer) error // contains filtered or unexported fields }
RunnerMock is a mock implementation of server.Runner.
func TestSomethingThatUsesRunner(t *testing.T) { // make and configure a mocked server.Runner mockedRunner := &RunnerMock{ RunFunc: func(ctx context.Context, command string, logWriter io.Writer) error { panic("mock out the Run method") }, } // use mockedRunner in code that requires server.Runner // and then make assertions. }
Click to show internal directories.
Click to hide internal directories.