Documentation
¶
Overview ¶
Package cmdtest holds shared test fixtures for pkg/cmd subcommand tests. Lives outside _test.go so subpackages anywhere under pkg/cmd can import it.
Index ¶
- Constants
- func NewFactory(t *testing.T, fake backend.Client, runner *testhelpers.FakeRunner) (*factory.Factory, *bytes.Buffer, *bytes.Buffer)
- func NewPRFactory(t *testing.T, fake backend.Client, runner *testhelpers.FakeRunner) (*factory.Factory, *bytes.Buffer, *bytes.Buffer)
- func NewPRRunner(extra ...testhelpers.RunResponse) *testhelpers.FakeRunner
- func NewRunner() *testhelpers.FakeRunner
- type NoBranchModelFake
- type NoBranchRuleFake
- type NoDefaultReviewerFake
- type NoDeployKeyFake
- type NoDeploymentFake
- type NoPipelineFake
- type NoSSHKeyFake
- type NoWorkspaceVarFake
Constants ¶
const Config = "bitbucket.org:\n oauth_token: tok\n user: alice\n git_protocol: https\n"
Config is the shared single-host Cloud config used by command tests.
const PRConfig = "bb.example.com:\n oauth_token: tok\n user: alice\n git_protocol: ssh\n"
PRConfig is the shared single-host Bitbucket Server config used by pr command tests.
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶
func NewFactory(t *testing.T, fake backend.Client, runner *testhelpers.FakeRunner) (*factory.Factory, *bytes.Buffer, *bytes.Buffer)
NewFactory wires the shared config, a backend.Client, and a runner.
func NewPRFactory ¶ added in v1.84.0
func NewPRFactory(t *testing.T, fake backend.Client, runner *testhelpers.FakeRunner) (*factory.Factory, *bytes.Buffer, *bytes.Buffer)
NewPRFactory wires the shared PR Server config, a backend.Client, and a runner.
func NewPRRunner ¶ added in v1.84.0
func NewPRRunner(extra ...testhelpers.RunResponse) *testhelpers.FakeRunner
NewPRRunner returns a FakeRunner pre-seeded with the remote URL response needed by PR sub-commands that operate on an existing PR.
func NewRunner ¶
func NewRunner() *testhelpers.FakeRunner
NewRunner returns a FakeRunner pre-seeded with a remote URL response.
Types ¶
type NoBranchModelFake ¶ added in v1.92.0
NoBranchModelFake wraps backend.Client without implementing backend.BranchModelClient — simulates a Bitbucket Server backend.
type NoBranchRuleFake ¶ added in v1.53.0
NoBranchRuleFake wraps backend.Client without implementing backend.BranchRuleClient — simulates a Bitbucket Server backend.
type NoDefaultReviewerFake ¶ added in v1.50.0
NoDefaultReviewerFake wraps backend.Client without implementing backend.DefaultReviewerClient — simulates a backend that doesn't support default reviewer management.
type NoDeployKeyFake ¶ added in v1.47.0
NoDeployKeyFake wraps backend.Client without implementing backend.DeployKeyClient — simulates a backend that doesn't support deploy keys.
type NoDeploymentFake ¶
NoDeploymentFake wraps backend.Client without implementing backend.DeploymentClient — simulates a Bitbucket Server backend.
type NoPipelineFake ¶
NoPipelineFake wraps backend.Client without implementing backend.PipelineClient — simulates a Bitbucket Server backend. Embedding the interface (not the concrete FakeClient) prevents pipeline-method promotion.
type NoSSHKeyFake ¶ added in v1.51.0
NoSSHKeyFake wraps backend.Client without implementing backend.SSHKeyClient — simulates a Bitbucket Server backend.
type NoWorkspaceVarFake ¶
NoWorkspaceVarFake wraps backend.Client without implementing backend.WorkspaceVariableClient.