Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureOutStreams ¶ added in v1.40.0
CaptureOutStreams redirects stdout & stderr while running fn and returns the outputs as a string. If there's an error during capture, it returns the error, otherwise it returns the error returned by fn.
func TestCommand ¶ added in v1.42.0
func TestCommand(t *testing.T, cmd TestableCommand, cases map[string]TestCase)
Types ¶
type Fixture ¶
type Fixture struct { MockController *gomock.Controller Client *hcapi2_mock.Client ActionWaiter *state.MockActionWaiter TokenEnsurer *state.MockTokenEnsurer Config *config.MockConfig Terminal *terminal.MockTerminal }
Fixture provides affordances for testing CLI commands.
func NewFixture ¶
NewFixture creates a new Fixture with default config file.
func NewFixtureWithConfigFile ¶ added in v1.44.0
NewFixtureWithConfigFile creates a new Fixture with the given config file. See config.Config.Read for the supported types of f.
func (*Fixture) ExpectEnsureToken ¶
func (f *Fixture) ExpectEnsureToken()
ExpectEnsureToken makes the mock TokenEnsurer expect a EnsureToken call.
func (*Fixture) Finish ¶
func (f *Fixture) Finish()
Finish must be called after the test is finished, preferably via `defer` directly after creating the Fixture.
Click to show internal directories.
Click to hide internal directories.