Documentation
¶
Index ¶
- func AssertContainsAuthHint(t *testing.T, got, hostname string)
- func AssertGolden(t *testing.T, name, got string)
- func AssertJSONArray(t *testing.T, got string, n int)
- func AssertNoOutput(t *testing.T, buf interface{ ... })
- func BackendPRFactory(opts ...BackendPROption) backend.PullRequest
- func BackendRepoFactory(opts ...BackendRepoOption) backend.Repository
- func BackendUserFactory(opts ...BackendUserOption) backend.User
- func CloudPRFactory(opts ...CloudPROption) map[string]any
- func CloudPagedResponse(values any) map[string]any
- func CloudRepoFactory(opts ...CloudRepoOption) map[string]any
- func NewTestServer(t *testing.T, stubs ...StubResponse) *httptest.Server
- func PRFactory(opts ...PROption) map[string]any
- func PagedResponse(values any) map[string]any
- func RepoFactory(opts ...RepoOption) map[string]any
- type BackendPROption
- type BackendRepoOption
- type BackendUserOption
- type BitbucketCloudServer
- func (b *BitbucketCloudServer) Build() *httptest.Server
- func (b *BitbucketCloudServer) WithCurrentUser(user map[string]any) *BitbucketCloudServer
- func (b *BitbucketCloudServer) WithError(pathSuffix string, status int, message string) *BitbucketCloudServer
- func (b *BitbucketCloudServer) WithPR(workspace, slug string, id int, pr map[string]any) *BitbucketCloudServer
- func (b *BitbucketCloudServer) WithPRList(workspace, slug string, prs []map[string]any) *BitbucketCloudServer
- func (b *BitbucketCloudServer) WithRepo(workspace, slug string, repo map[string]any) *BitbucketCloudServer
- func (b *BitbucketCloudServer) WithRepoList(workspace string, repos []map[string]any) *BitbucketCloudServer
- type BitbucketServer
- func (b *BitbucketServer) Build() *httptest.Server
- func (b *BitbucketServer) WithApplicationProperties(version string) *BitbucketServer
- func (b *BitbucketServer) WithCurrentUser(user map[string]any) *BitbucketServer
- func (b *BitbucketServer) WithError(pathSuffix string, status int, message string) *BitbucketServer
- func (b *BitbucketServer) WithPR(project, slug string, id int, pr map[string]any) *BitbucketServer
- func (b *BitbucketServer) WithPRList(project, slug string, prs []map[string]any) *BitbucketServer
- func (b *BitbucketServer) WithRepo(project, slug string, repo map[string]any) *BitbucketServer
- func (b *BitbucketServer) WithRepoList(repos []map[string]any) *BitbucketServer
- type Call
- type CloudPROption
- type CloudRepoOption
- type FakeBrowserLauncher
- type FakeClient
- func (c *FakeClient) AddAnnotations(project, slug, hash, key string, in []backend.CodeInsightsAnnotationInput) error
- func (c *FakeClient) AddBranchRule(ns, slug string, input backend.BranchRuleInput) (backend.BranchRule, error)
- func (c *FakeClient) AddCommitComment(ns, slug, hash string, in backend.AddCommitCommentInput) (backend.CommitComment, error)
- func (c *FakeClient) AddDefaultReviewer(ns, slug, userSlug string) error
- func (c *FakeClient) AddDeployKey(ns, slug string, input backend.DeployKeyInput) (backend.DeployKey, error)
- func (c *FakeClient) AddIssueComment(ns, slug string, id int, body string) (backend.IssueComment, error)
- func (c *FakeClient) AddPRComment(ns, slug string, id int, in backend.AddPRCommentInput) (backend.PRComment, error)
- func (c *FakeClient) AddSSHKey(input backend.SSHKeyInput) (backend.SSHKey, error)
- func (c *FakeClient) ApprovePR(ns, slug string, id int) error
- func (c *FakeClient) AssignIssue(ns, slug string, id int, assignee string) error
- func (c *FakeClient) CreateBranch(ns, slug string, in backend.CreateBranchInput) (backend.Branch, error)
- func (c *FakeClient) CreateBranchProtection(ns, slug string, in backend.CreateBranchProtectionInput) (backend.BranchProtection, error)
- func (c *FakeClient) CreateEnvironment(ns, slug string, in backend.CreateEnvironmentInput) (backend.Environment, error)
- func (c *FakeClient) CreateIssue(ns, slug string, in backend.CreateIssueInput) (backend.Issue, error)
- func (c *FakeClient) CreatePR(ns, slug string, in backend.CreatePRInput) (backend.PullRequest, error)
- func (c *FakeClient) CreatePipelineSchedule(ns, slug string, input backend.PipelineScheduleInput) (backend.PipelineSchedule, error)
- func (c *FakeClient) CreateRepo(ns string, in backend.CreateRepoInput) (backend.Repository, error)
- func (c *FakeClient) CreateReviewerGroup(ns, slug string, in backend.CreateReviewerGroupInput) (backend.ReviewerGroup, error)
- func (c *FakeClient) CreateTag(ns, slug string, in backend.CreateTagInput) (backend.Tag, error)
- func (c *FakeClient) CreateWebhook(ns, slug string, in backend.CreateWebhookInput) (backend.Webhook, error)
- func (c *FakeClient) CreateWorkspaceWebhook(workspace string, in backend.CreateWebhookInput) (backend.Webhook, error)
- func (c *FakeClient) DeclinePR(ns, slug string, id int) error
- func (c *FakeClient) DefaultReviewers(ns, slug, fromBranch, toBranch string) ([]backend.User, error)
- func (c *FakeClient) DeleteAnnotations(project, slug, hash, key string) error
- func (c *FakeClient) DeleteBranch(ns, slug, branch string) error
- func (c *FakeClient) DeleteBranchProtection(ns, slug string, id int) error
- func (c *FakeClient) DeleteBranchRule(ns, slug string, id int) error
- func (c *FakeClient) DeleteCommitComment(ns, slug, hash string, commentID int) error
- func (c *FakeClient) DeleteDeployKey(ns, slug string, id int) error
- func (c *FakeClient) DeleteEnvVariable(ns, slug, envUUID, varUUID string) error
- func (c *FakeClient) DeleteEnvironment(ns, slug, uuid string) error
- func (c *FakeClient) DeleteIssueComment(ns, slug string, id, commentID int) error
- func (c *FakeClient) DeleteMergeCheck(project, slug, key string) error
- func (c *FakeClient) DeletePRComment(ns, slug string, id, commentID int) error
- func (c *FakeClient) DeletePipelineCache(ns, slug, uuid string) error
- func (c *FakeClient) DeletePipelineSchedule(ns, slug, uuid string) error
- func (c *FakeClient) DeletePipelineVariable(ns, slug, key string) error
- func (c *FakeClient) DeleteRepo(ns, slug string) error
- func (c *FakeClient) DeleteReport(project, slug, hash, key string) error
- func (c *FakeClient) DeleteReviewerGroup(ns, slug string, id int) error
- func (c *FakeClient) DeleteSSHKey(id int) error
- func (c *FakeClient) DeleteTag(ns, slug, name string) error
- func (c *FakeClient) DeleteWebhook(ns, slug, id string) error
- func (c *FakeClient) DeleteWorkspaceVariable(ns, key string) error
- func (c *FakeClient) DeleteWorkspaceWebhook(workspace, uuid string) error
- func (c *FakeClient) DisableAutoMerge(ns, slug string, id int) error
- func (c *FakeClient) EditCommitComment(ns, slug, hash string, commentID int, body string) (backend.CommitComment, error)
- func (c *FakeClient) EditIssueComment(ns, slug string, id, commentID int, body string) (backend.IssueComment, error)
- func (c *FakeClient) EditPRComment(ns, slug string, id, commentID int, body string) (backend.PRComment, error)
- func (c *FakeClient) EnableAutoMerge(ns, slug string, id int, strategy string) error
- func (c *FakeClient) ForkRepo(ns, slug string, in backend.ForkRepoInput) (backend.Repository, error)
- func (c *FakeClient) GetCommit(ns, slug, hash string) (backend.Commit, error)
- func (c *FakeClient) GetCurrentUser() (backend.User, error)
- func (c *FakeClient) GetDeployment(ns, slug, uuid string) (backend.Deployment, error)
- func (c *FakeClient) GetDiff(ns, slug, from, to string) (string, error)
- func (c *FakeClient) GetDiffStat(ns, slug, from, to string) (backend.DiffStat, error)
- func (c *FakeClient) GetFileContent(ns, slug, ref, path string) ([]byte, error)
- func (c *FakeClient) GetIssue(ns, slug string, id int) (backend.Issue, error)
- func (c *FakeClient) GetLoggingConfig() (backend.LoggingConfig, error)
- func (c *FakeClient) GetMergeCheck(project, slug, key string) (backend.MergeCheck, error)
- func (c *FakeClient) GetPR(ns, slug string, id int) (backend.PullRequest, error)
- func (c *FakeClient) GetPRActivity(ns, slug string, id int, limit int) ([]backend.PRActivityEvent, error)
- func (c *FakeClient) GetPRDiff(ns, slug string, id int) (string, error)
- func (c *FakeClient) GetPipeline(ns, slug, uuid string) (backend.Pipeline, error)
- func (c *FakeClient) GetPipelineStepLog(ns, slug, pipelineUUID, stepUUID string) (io.ReadCloser, error)
- func (c *FakeClient) GetRepo(ns, slug string) (backend.Repository, error)
- func (c *FakeClient) GetReport(project, slug, hash, key string) (backend.CodeInsightsReport, error)
- func (c *FakeClient) GetWebhook(ns, slug, id string) (backend.Webhook, error)
- func (c *FakeClient) GrantProjectPermission(ctx context.Context, project string, subject backend.PermissionSubject, ...) error
- func (c *FakeClient) GrantRepoPermission(ctx context.Context, project, slug string, subject backend.PermissionSubject, ...) error
- func (c *FakeClient) ListAnnotations(project, slug, hash, key string) ([]backend.CodeInsightsAnnotation, error)
- func (c *FakeClient) ListBranchProtections(ns, slug string, limit int) ([]backend.BranchProtection, error)
- func (c *FakeClient) ListBranchRules(ns, slug string) ([]backend.BranchRule, error)
- func (c *FakeClient) ListBranches(ns, slug string, limit int) ([]backend.Branch, error)
- func (c *FakeClient) ListCommitComments(ns, slug, hash string, limit int) ([]backend.CommitComment, error)
- func (c *FakeClient) ListCommitFiles(ns, slug, hash string) ([]backend.DiffStatEntry, error)
- func (c *FakeClient) ListCommitStatuses(ns, slug, hash string) ([]backend.CommitStatus, error)
- func (c *FakeClient) ListCommits(ns, slug, branch string, limit int) ([]backend.Commit, error)
- func (c *FakeClient) ListDefaultReviewers(ns, slug string) ([]backend.DefaultReviewer, error)
- func (c *FakeClient) ListDeployKeys(ns, slug string) ([]backend.DeployKey, error)
- func (c *FakeClient) ListDeployments(ns, slug string, limit int) ([]backend.Deployment, error)
- func (c *FakeClient) ListEnvVariables(ns, slug, envUUID string) ([]backend.EnvVariable, error)
- func (c *FakeClient) ListEnvironments(ns, slug string) ([]backend.Environment, error)
- func (c *FakeClient) ListIssueComments(ns, slug string, id int) ([]backend.IssueComment, error)
- func (c *FakeClient) ListIssues(ns, slug, state string, limit int) ([]backend.Issue, error)
- func (c *FakeClient) ListMyPRs(ns, slug string) ([]backend.MyPREntry, error)
- func (c *FakeClient) ListPRComments(ns, slug string, id int) ([]backend.PRComment, error)
- func (c *FakeClient) ListPRCommits(ns, slug string, prID int) ([]backend.Commit, error)
- func (c *FakeClient) ListPRFiles(ns, slug string, prID int) ([]backend.DiffStatEntry, error)
- func (c *FakeClient) ListPRParticipants(ns, slug string, prID int) ([]backend.PRParticipant, error)
- func (c *FakeClient) ListPRs(ns, slug, state string, limit int) ([]backend.PullRequest, error)
- func (c *FakeClient) ListPipelineCaches(ns, slug string) ([]backend.PipelineCache, error)
- func (c *FakeClient) ListPipelineSchedules(ns, slug string) ([]backend.PipelineSchedule, error)
- func (c *FakeClient) ListPipelineSteps(ns, slug, uuid string) ([]backend.PipelineStep, error)
- func (c *FakeClient) ListPipelineVariables(ns, slug string) ([]backend.PipelineVariable, error)
- func (c *FakeClient) ListPipelines(ns, slug string, limit int) ([]backend.Pipeline, error)
- func (c *FakeClient) ListProjectPermissions(ctx context.Context, project string) ([]backend.PermissionGrant, error)
- func (c *FakeClient) ListProjects(workspace string, limit int) ([]backend.Project, error)
- func (c *FakeClient) ListRepoForks(ns, slug string, limit int) ([]backend.Repository, error)
- func (c *FakeClient) ListRepoPermissions(ctx context.Context, project, slug string) ([]backend.PermissionGrant, error)
- func (c *FakeClient) ListRepoWatchers(ns, slug string) ([]backend.User, error)
- func (c *FakeClient) ListReports(project, slug, hash string) ([]backend.CodeInsightsReport, error)
- func (c *FakeClient) ListRepos(ns string, limit int) ([]backend.Repository, error)
- func (c *FakeClient) ListReviewerGroups(ns, slug string) ([]backend.ReviewerGroup, error)
- func (c *FakeClient) ListSSHKeys() ([]backend.SSHKey, error)
- func (c *FakeClient) ListTags(ns, slug string, limit int) ([]backend.Tag, error)
- func (c *FakeClient) ListTree(ns, slug, ref, path string) ([]backend.TreeEntry, error)
- func (c *FakeClient) ListWebhooks(ns, slug string) ([]backend.Webhook, error)
- func (c *FakeClient) ListWorkspaceMembers(workspace string, limit int) ([]backend.WorkspaceMember, error)
- func (c *FakeClient) ListWorkspaceVariables(ns string) ([]backend.PipelineVariable, error)
- func (c *FakeClient) ListWorkspaceWebhooks(workspace string) ([]backend.Webhook, error)
- func (c *FakeClient) ListWorkspaces(limit int) ([]backend.Workspace, error)
- func (c *FakeClient) MergePR(ns, slug string, id int, in backend.MergePRInput) (backend.PullRequest, error)
- func (c *FakeClient) ReadyPR(ns, slug string, id int) error
- func (c *FakeClient) RemoveDefaultReviewer(ns, slug, userSlug string) error
- func (c *FakeClient) RemoveReviewers(ns, slug string, id int, users []string) error
- func (c *FakeClient) RenameRepo(ns, slug, newName string) (backend.Repository, error)
- func (c *FakeClient) ReopenIssue(ns, slug string, id int) error
- func (c *FakeClient) ReportCommitStatus(ns, slug, hash string, input backend.CommitStatusInput) (backend.CommitStatus, error)
- func (c *FakeClient) RequestReview(ns, slug string, id int, users []string) error
- func (c *FakeClient) RevokeProjectPermission(ctx context.Context, project string, subject backend.PermissionSubject) error
- func (c *FakeClient) RevokeRepoPermission(ctx context.Context, project, slug string, subject backend.PermissionSubject) error
- func (c *FakeClient) RotateSecrets() error
- func (c *FakeClient) RunPipeline(ns, slug string, in backend.RunPipelineInput) (backend.Pipeline, error)
- func (c *FakeClient) SearchCode(workspace, query string, limit int) ([]backend.CodeSearchHit, error)
- func (c *FakeClient) SetEnvVariable(ns, slug, envUUID string, in backend.EnvVariableInput) (backend.EnvVariable, error)
- func (c *FakeClient) SetLoggingConfig(in backend.LoggingConfigInput) error
- func (c *FakeClient) SetMergeCheck(project, slug, key string, in backend.MergeCheckInput) error
- func (c *FakeClient) SetPipelineVariable(ns, slug string, in backend.PipelineVariableInput) (backend.PipelineVariable, error)
- func (c *FakeClient) SetRepoVisibility(ns, slug string, isPrivate bool) error
- func (c *FakeClient) SetReport(project, slug, hash, key string, in backend.CodeInsightsReportInput) (backend.CodeInsightsReport, error)
- func (c *FakeClient) SetWorkspaceVariable(ns string, in backend.PipelineVariableInput) (backend.PipelineVariable, error)
- func (c *FakeClient) SubmitReview(ns, slug string, id int, in backend.SubmitReviewInput) error
- func (c *FakeClient) TransferRepo(ns, slug, target string) (backend.Repository, error)
- func (c *FakeClient) TriggerPipeline(ns, slug string, input backend.PipelineTriggerInput) (backend.PipelineTriggerResult, error)
- func (c *FakeClient) UnapprovePR(ns, slug string, id int) error
- func (c *FakeClient) UnreadyPR(ns, slug string, id int) error
- func (c *FakeClient) UpdateIssue(ns, slug string, id int, in backend.UpdateIssueInput) (backend.Issue, error)
- func (c *FakeClient) UpdatePR(ns, slug string, id int, in backend.UpdatePRInput) (backend.PullRequest, error)
- func (c *FakeClient) UpdatePRBranch(ns, slug string, prID int) error
- type FakeEditorLauncher
- type FakeKeyring
- type FakeRunner
- type IOStreams
- type PROption
- type RepoOption
- type RunResponse
- type StubResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertContainsAuthHint ¶
AssertContainsAuthHint asserts the output contains an auth login hint for the given hostname.
func AssertGolden ¶
AssertGolden compares got against the contents of testdata/<name>.golden relative to the current test's package. When the BITBOTTLE_UPDATE_GOLDEN environment variable is set to a truthy value, the golden file is written instead of compared.
func AssertJSONArray ¶
AssertJSONArray asserts that got is a valid JSON array of length n.
func AssertNoOutput ¶
AssertNoOutput asserts that a buffer-like value produced no output.
func BackendPRFactory ¶
func BackendPRFactory(opts ...BackendPROption) backend.PullRequest
BackendPRFactory returns a default backend.PullRequest with options applied.
func BackendRepoFactory ¶
func BackendRepoFactory(opts ...BackendRepoOption) backend.Repository
BackendRepoFactory returns a default backend.Repository with options applied.
func BackendUserFactory ¶
func BackendUserFactory(opts ...BackendUserOption) backend.User
BackendUserFactory returns a default backend.User with options applied.
func CloudPRFactory ¶
func CloudPRFactory(opts ...CloudPROption) map[string]any
CloudPRFactory returns a default Bitbucket Cloud pull request object.
func CloudPagedResponse ¶
CloudPagedResponse wraps the given values slice in a Bitbucket Cloud paged envelope.
func CloudRepoFactory ¶
func CloudRepoFactory(opts ...CloudRepoOption) map[string]any
CloudRepoFactory returns a default Bitbucket Cloud repository object.
func NewTestServer ¶
func NewTestServer(t *testing.T, stubs ...StubResponse) *httptest.Server
NewTestServer returns an httptest.NewTLSServer that dispatches requests to the first stub whose Method + PathSuffix match. Unmatched requests fail the test immediately.
func PRFactory ¶
PRFactory returns a default Bitbucket pull request object with optional functional overrides applied in order.
func PagedResponse ¶
PagedResponse wraps the given values slice in a Bitbucket paged envelope.
func RepoFactory ¶
func RepoFactory(opts ...RepoOption) map[string]any
RepoFactory returns a default Bitbucket repository object with optional functional overrides applied in order.
Types ¶
type BackendPROption ¶
type BackendPROption func(*backend.PullRequest)
BackendPROption mutates a backend.PullRequest.
func BackendPRWithFromBranch ¶
func BackendPRWithFromBranch(branch string) BackendPROption
BackendPRWithFromBranch sets FromBranch on a backend.PullRequest.
func BackendPRWithID ¶
func BackendPRWithID(id int) BackendPROption
BackendPRWithID sets the ID on a backend.PullRequest.
func BackendPRWithState ¶
func BackendPRWithState(state string) BackendPROption
BackendPRWithState sets State on a backend.PullRequest.
func BackendPRWithTitle ¶
func BackendPRWithTitle(title string) BackendPROption
BackendPRWithTitle sets Title on a backend.PullRequest.
func BackendPRWithWebURL ¶
func BackendPRWithWebURL(url string) BackendPROption
BackendPRWithWebURL sets the WebURL on a backend.PullRequest.
type BackendRepoOption ¶
type BackendRepoOption func(*backend.Repository)
BackendRepoOption mutates a backend.Repository.
func BackendRepoWithSlug ¶
func BackendRepoWithSlug(slug string) BackendRepoOption
BackendRepoWithSlug sets the slug on a backend.Repository.
func BackendRepoWithWebURL ¶
func BackendRepoWithWebURL(url string) BackendRepoOption
BackendRepoWithWebURL sets the WebURL on a backend.Repository.
type BackendUserOption ¶
BackendUserOption mutates a backend.User.
func BackendUserWithSlug ¶
func BackendUserWithSlug(slug string) BackendUserOption
BackendUserWithSlug sets the slug on a backend.User.
type BitbucketCloudServer ¶
type BitbucketCloudServer struct {
// contains filtered or unexported fields
}
BitbucketCloudServer is a fluent builder around NewTestServer that knows common Bitbucket Cloud API v2.0 endpoints. Cloud paths use /2.0/... prefix.
func NewBitbucketCloudServer ¶
func NewBitbucketCloudServer(t *testing.T) *BitbucketCloudServer
NewBitbucketCloudServer creates a new fluent BitbucketCloudServer builder.
func (*BitbucketCloudServer) Build ¶
func (b *BitbucketCloudServer) Build() *httptest.Server
Build constructs the httptest.Server using the accumulated stubs.
func (*BitbucketCloudServer) WithCurrentUser ¶
func (b *BitbucketCloudServer) WithCurrentUser(user map[string]any) *BitbucketCloudServer
WithCurrentUser stubs GET /user.
func (*BitbucketCloudServer) WithError ¶
func (b *BitbucketCloudServer) WithError(pathSuffix string, status int, message string) *BitbucketCloudServer
WithError stubs an error response in Cloud format for paths ending with pathSuffix.
func (*BitbucketCloudServer) WithPR ¶
func (b *BitbucketCloudServer) WithPR(workspace, slug string, id int, pr map[string]any) *BitbucketCloudServer
WithPR stubs GET /repositories/{workspace}/{slug}/pullrequests/{id}.
func (*BitbucketCloudServer) WithPRList ¶
func (b *BitbucketCloudServer) WithPRList(workspace, slug string, prs []map[string]any) *BitbucketCloudServer
WithPRList stubs GET /repositories/{workspace}/{slug}/pullrequests.
func (*BitbucketCloudServer) WithRepo ¶
func (b *BitbucketCloudServer) WithRepo(workspace, slug string, repo map[string]any) *BitbucketCloudServer
WithRepo stubs GET /repositories/{workspace}/{slug}.
func (*BitbucketCloudServer) WithRepoList ¶
func (b *BitbucketCloudServer) WithRepoList(workspace string, repos []map[string]any) *BitbucketCloudServer
WithRepoList stubs GET /repositories/{workspace} with the provided list.
type BitbucketServer ¶
type BitbucketServer struct {
// contains filtered or unexported fields
}
BitbucketServer is a fluent builder around NewTestServer that knows common Bitbucket Data Center endpoints.
func NewBitbucketServer ¶
func NewBitbucketServer(t *testing.T) *BitbucketServer
NewBitbucketServer creates a new fluent BitbucketServer builder.
func (*BitbucketServer) Build ¶
func (b *BitbucketServer) Build() *httptest.Server
Build constructs the httptest.Server using the accumulated stubs.
func (*BitbucketServer) WithApplicationProperties ¶
func (b *BitbucketServer) WithApplicationProperties(version string) *BitbucketServer
WithApplicationProperties stubs GET /rest/api/1.0/application-properties.
func (*BitbucketServer) WithCurrentUser ¶
func (b *BitbucketServer) WithCurrentUser(user map[string]any) *BitbucketServer
WithCurrentUser stubs the "current user" endpoint used for whoami-style calls.
func (*BitbucketServer) WithError ¶
func (b *BitbucketServer) WithError(pathSuffix string, status int, message string) *BitbucketServer
WithError stubs an error response matching any request whose path ends with pathSuffix.
func (*BitbucketServer) WithPR ¶
func (b *BitbucketServer) WithPR(project, slug string, id int, pr map[string]any) *BitbucketServer
WithPR stubs GET .../pull-requests/{id}.
func (*BitbucketServer) WithPRList ¶
func (b *BitbucketServer) WithPRList(project, slug string, prs []map[string]any) *BitbucketServer
WithPRList stubs GET /rest/api/1.0/projects/{project}/repos/{slug}/pull-requests.
func (*BitbucketServer) WithRepo ¶
func (b *BitbucketServer) WithRepo(project, slug string, repo map[string]any) *BitbucketServer
WithRepo stubs GET /rest/api/1.0/projects/{project}/repos/{slug}.
func (*BitbucketServer) WithRepoList ¶
func (b *BitbucketServer) WithRepoList(repos []map[string]any) *BitbucketServer
WithRepoList stubs GET /rest/api/1.0/repos with the provided list of repos.
type CloudPROption ¶
CloudPROption mutates a Bitbucket Cloud pull request fixture.
func CloudPRWithAuthor ¶
func CloudPRWithAuthor(accountID, displayName string) CloudPROption
CloudPRWithAuthor sets the Cloud PR author account_id and display_name.
func CloudPRWithDraft ¶
func CloudPRWithDraft(draft bool) CloudPROption
CloudPRWithDraft sets the draft flag on a Cloud PR.
func CloudPRWithState ¶
func CloudPRWithState(state string) CloudPROption
CloudPRWithState sets the Cloud PR state.
func CloudPRWithTitle ¶
func CloudPRWithTitle(title string) CloudPROption
CloudPRWithTitle sets the Cloud PR title.
type CloudRepoOption ¶
CloudRepoOption mutates a Bitbucket Cloud repository fixture.
func CloudRepoWithSlug ¶
func CloudRepoWithSlug(workspace, slug string) CloudRepoOption
CloudRepoWithSlug sets the slug, name, and full_name of the cloud repo.
type FakeBrowserLauncher ¶
FakeBrowserLauncher is a test double for a browser.Launcher.
func (*FakeBrowserLauncher) Browse ¶
func (b *FakeBrowserLauncher) Browse(url string) error
Browse records the URL and returns the configured error, if any.
type FakeClient ¶
type FakeClient struct {
T *testing.T
// Repo methods
ListReposFn func(ns string, limit int) ([]backend.Repository, error)
GetRepoFn func(ns, slug string) (backend.Repository, error)
CreateRepoFn func(ns string, in backend.CreateRepoInput) (backend.Repository, error)
DeleteRepoFn func(ns, slug string) error
RenameRepoFn func(ns, slug, newName string) (backend.Repository, error)
ForkRepoFn func(ns, slug string, in backend.ForkRepoInput) (backend.Repository, error)
TransferRepoFn func(ns, slug, target string) (backend.Repository, error)
SetRepoVisibilityFn func(ns, slug string, isPrivate bool) error
// PR methods
ListPRsFn func(ns, slug, state string, limit int) ([]backend.PullRequest, error)
GetPRFn func(ns, slug string, id int) (backend.PullRequest, error)
CreatePRFn func(ns, slug string, in backend.CreatePRInput) (backend.PullRequest, error)
MergePRFn func(ns, slug string, id int, in backend.MergePRInput) (backend.PullRequest, error)
EnableAutoMergeFn func(ns, slug string, id int, strategy string) error
DisableAutoMergeFn func(ns, slug string, id int) error
ApprovePRFn func(ns, slug string, id int) error
GetPRDiffFn func(ns, slug string, id int) (string, error)
// Branch / user methods
ListBranchesFn func(ns, slug string, limit int) ([]backend.Branch, error)
DeleteBranchFn func(ns, slug, branch string) error
GetCurrentUserFn func() (backend.User, error)
// Branch create method
CreateBranchFn func(ns, slug string, in backend.CreateBranchInput) (backend.Branch, error)
// Tag methods
ListTagsFn func(ns, slug string, limit int) ([]backend.Tag, error)
CreateTagFn func(ns, slug string, in backend.CreateTagInput) (backend.Tag, error)
DeleteTagFn func(ns, slug, name string) error
// PR lifecycle methods
UpdatePRFn func(ns, slug string, id int, in backend.UpdatePRInput) (backend.PullRequest, error)
DeclinePRFn func(ns, slug string, id int) error
UnapprovePRFn func(ns, slug string, id int) error
ReadyPRFn func(ns, slug string, id int) error
UnreadyPRFn func(ns, slug string, id int) error
RequestReviewFn func(ns, slug string, id int, users []string) error
RemoveReviewersFn func(ns, slug string, id int, users []string) error
SubmitReviewFn func(ns, slug string, id int, in backend.SubmitReviewInput) error
// Pipeline methods (Cloud-only; satisfies backend.PipelineClient when set)
ListPipelinesFn func(ns, slug string, limit int) ([]backend.Pipeline, error)
GetPipelineFn func(ns, slug, uuid string) (backend.Pipeline, error)
RunPipelineFn func(ns, slug string, in backend.RunPipelineInput) (backend.Pipeline, error)
ListPipelineStepsFn func(ns, slug, uuid string) ([]backend.PipelineStep, error)
GetPipelineStepLogFn func(ns, slug, pipelineUUID, stepUUID string) (io.ReadCloser, error)
ListPipelineVariablesFn func(ns, slug string) ([]backend.PipelineVariable, error)
SetPipelineVariableFn func(ns, slug string, in backend.PipelineVariableInput) (backend.PipelineVariable, error)
DeletePipelineVariableFn func(ns, slug, key string) error
// Commit methods
ListCommitsFn func(ns, slug, branch string, limit int) ([]backend.Commit, error)
GetCommitFn func(ns, slug, hash string) (backend.Commit, error)
// Commit comment methods
ListCommitCommentsFn func(ns, slug, hash string, limit int) ([]backend.CommitComment, error)
AddCommitCommentFn func(ns, slug, hash string, in backend.AddCommitCommentInput) (backend.CommitComment, error)
EditCommitCommentFn func(ns, slug, hash string, commentID int, body string) (backend.CommitComment, error)
DeleteCommitCommentFn func(ns, slug, hash string, commentID int) error
// PR comment methods
ListPRCommentsFn func(ns, slug string, id int) ([]backend.PRComment, error)
AddPRCommentFn func(ns, slug string, id int, in backend.AddPRCommentInput) (backend.PRComment, error)
EditPRCommentFn func(ns, slug string, id, commentID int, body string) (backend.PRComment, error)
DeletePRCommentFn func(ns, slug string, id, commentID int) error
// PR comment reaction methods (Server-only; satisfies backend.CommentReactor when set)
ListCommentReactionsFn func(ns, slug string, prID, commentID int) ([]backend.CommentReaction, error)
AddCommentReactionFn func(ns, slug string, prID, commentID int, emoji string) error
RemoveCommentReactionFn func(ns, slug string, prID, commentID int, emoji string) error
// PR activity
GetPRActivityFn func(ns, slug string, id int, limit int) ([]backend.PRActivityEvent, error)
// Commit status methods
ListCommitStatusesFn func(ns, slug, hash string) ([]backend.CommitStatus, error)
ReportCommitStatusFn func(ns, slug, hash string, input backend.CommitStatusInput) (backend.CommitStatus, error)
// Webhook methods
ListWebhooksFn func(ns, slug string) ([]backend.Webhook, error)
GetWebhookFn func(ns, slug, id string) (backend.Webhook, error)
CreateWebhookFn func(ns, slug string, in backend.CreateWebhookInput) (backend.Webhook, error)
DeleteWebhookFn func(ns, slug, id string) error
// Workspace methods (Cloud-only; satisfies backend.WorkspaceClient when set)
ListWorkspacesFn func(limit int) ([]backend.Workspace, error)
ListProjectsFn func(workspace string, limit int) ([]backend.Project, error)
// Workspace member methods (Cloud-only; satisfies backend.WorkspaceMemberClient when set)
ListWorkspaceMembersFn func(workspace string, limit int) ([]backend.WorkspaceMember, error)
// Workspace webhook methods (Cloud-only; satisfies backend.WorkspaceWebhookClient when set)
ListWorkspaceWebhooksFn func(workspace string) ([]backend.Webhook, error)
CreateWorkspaceWebhookFn func(workspace string, in backend.CreateWebhookInput) (backend.Webhook, error)
DeleteWorkspaceWebhookFn func(workspace, uuid string) error
// Issue methods (Cloud-only; satisfies backend.IssueClient when set)
ListIssuesFn func(ns, slug, state string, limit int) ([]backend.Issue, error)
GetIssueFn func(ns, slug string, id int) (backend.Issue, error)
CreateIssueFn func(ns, slug string, in backend.CreateIssueInput) (backend.Issue, error)
UpdateIssueFn func(ns, slug string, id int, in backend.UpdateIssueInput) (backend.Issue, error)
ReopenIssueFn func(ns, slug string, id int) error
AssignIssueFn func(ns, slug string, id int, assignee string) error
ListIssueCommentsFn func(ns, slug string, id int) ([]backend.IssueComment, error)
AddIssueCommentFn func(ns, slug string, id int, body string) (backend.IssueComment, error)
EditIssueCommentFn func(ns, slug string, id, commentID int, body string) (backend.IssueComment, error)
DeleteIssueCommentFn func(ns, slug string, id, commentID int) error
// GHP methods
UpdatePRBranchFn func(ns, slug string, prID int) error
ListMyPRsFn func(ns, slug string) ([]backend.MyPREntry, error)
// Default reviewers (Server-only; satisfies backend.DefaultReviewersResolver when set)
DefaultReviewersFn func(ns, slug, fromBranch, toBranch string) ([]backend.User, error)
// Branch protection (Server-only; satisfies backend.BranchProtector when set)
ListBranchProtectionsFn func(ns, slug string, limit int) ([]backend.BranchProtection, error)
CreateBranchProtectionFn func(ns, slug string, in backend.CreateBranchProtectionInput) (backend.BranchProtection, error)
DeleteBranchProtectionFn func(ns, slug string, id int) error
// Code search (Cloud-only; satisfies backend.CodeSearcher when set)
SearchCodeFn func(workspace, query string, limit int) ([]backend.CodeSearchHit, error)
// Source primitives (both backends; satisfies backend.SourceReader when set)
GetFileContentFn func(ns, slug, ref, path string) ([]byte, error)
ListTreeFn func(ns, slug, ref, path string) ([]backend.TreeEntry, error)
// Deployment methods (Cloud-only; satisfies backend.DeploymentClient when set)
ListDeploymentsFn func(ns, slug string, limit int) ([]backend.Deployment, error)
GetDeploymentFn func(ns, slug, uuid string) (backend.Deployment, error)
ListEnvironmentsFn func(ns, slug string) ([]backend.Environment, error)
CreateEnvironmentFn func(ns, slug string, in backend.CreateEnvironmentInput) (backend.Environment, error)
DeleteEnvironmentFn func(ns, slug, uuid string) error
ListEnvVariablesFn func(ns, slug, envUUID string) ([]backend.EnvVariable, error)
SetEnvVariableFn func(ns, slug, envUUID string, in backend.EnvVariableInput) (backend.EnvVariable, error)
DeleteEnvVariableFn func(ns, slug, envUUID, varUUID string) error
// Workspace variable methods (Cloud-only; satisfies backend.WorkspaceVariableClient when set)
ListWorkspaceVariablesFn func(ns string) ([]backend.PipelineVariable, error)
SetWorkspaceVariableFn func(ns string, in backend.PipelineVariableInput) (backend.PipelineVariable, error)
DeleteWorkspaceVariableFn func(ns, key string) error
// Permissions methods (Server-only; satisfies backend.PermissionsClient when set)
ListProjectPermissionsFn func(ctx context.Context, project string) ([]backend.PermissionGrant, error)
GrantProjectPermissionFn func(ctx context.Context, project string, subject backend.PermissionSubject, perm string) error
RevokeProjectPermissionFn func(ctx context.Context, project string, subject backend.PermissionSubject) error
ListRepoPermissionsFn func(ctx context.Context, project, slug string) ([]backend.PermissionGrant, error)
GrantRepoPermissionFn func(ctx context.Context, project, slug string, subject backend.PermissionSubject, perm string) error
RevokeRepoPermissionFn func(ctx context.Context, project, slug string, subject backend.PermissionSubject) error
// Admin methods (Server-only; satisfies backend.AdminClient when set)
RotateSecretsFn func() error
GetLoggingConfigFn func() (backend.LoggingConfig, error)
SetLoggingConfigFn func(in backend.LoggingConfigInput) error
// Code Insights (Server-only; satisfies backend.CodeInsightsClient when set)
ListReportsFn func(project, slug, hash string) ([]backend.CodeInsightsReport, error)
GetReportFn func(project, slug, hash, key string) (backend.CodeInsightsReport, error)
SetReportFn func(project, slug, hash, key string, in backend.CodeInsightsReportInput) (backend.CodeInsightsReport, error)
DeleteReportFn func(project, slug, hash, key string) error
ListAnnotationsFn func(project, slug, hash, key string) ([]backend.CodeInsightsAnnotation, error)
AddAnnotationsFn func(project, slug, hash, key string, in []backend.CodeInsightsAnnotationInput) error
DeleteAnnotationsFn func(project, slug, hash, key string) error
SetMergeCheckFn func(project, slug, key string, in backend.MergeCheckInput) error
GetMergeCheckFn func(project, slug, key string) (backend.MergeCheck, error)
DeleteMergeCheckFn func(project, slug, key string) error
// Branch rule methods (Cloud-only; satisfies backend.BranchRuleClient when set)
ListBranchRulesFn func(ns, slug string) ([]backend.BranchRule, error)
AddBranchRuleFn func(ns, slug string, input backend.BranchRuleInput) (backend.BranchRule, error)
DeleteBranchRuleFn func(ns, slug string, id int) error
// Deploy key methods (both backends; satisfies backend.DeployKeyClient when set)
ListDeployKeysFn func(ns, slug string) ([]backend.DeployKey, error)
AddDeployKeyFn func(ns, slug string, input backend.DeployKeyInput) (backend.DeployKey, error)
DeleteDeployKeyFn func(ns, slug string, id int) error
// Commit file methods (both backends; satisfies backend.CommitFileClient when set)
ListCommitFilesFn func(ns, slug, hash string) ([]backend.DiffStatEntry, error)
// SSH key methods (Cloud-only; satisfies backend.SSHKeyClient when set)
ListSSHKeysFn func() ([]backend.SSHKey, error)
AddSSHKeyFn func(input backend.SSHKeyInput) (backend.SSHKey, error)
DeleteSSHKeyFn func(id int) error
// Default reviewer CRUD methods (both backends; satisfies backend.DefaultReviewerClient when set)
ListDefaultReviewersFn func(ns, slug string) ([]backend.DefaultReviewer, error)
AddDefaultReviewerFn func(ns, slug, userSlug string) error
RemoveDefaultReviewerFn func(ns, slug, userSlug string) error
// Reviewer group methods (Server-only; satisfies backend.ReviewerGroupClient when set)
ListReviewerGroupsFn func(ns, slug string) ([]backend.ReviewerGroup, error)
CreateReviewerGroupFn func(ns, slug string, in backend.CreateReviewerGroupInput) (backend.ReviewerGroup, error)
DeleteReviewerGroupFn func(ns, slug string, id int) error
// Pipeline trigger methods (Cloud-only; satisfies backend.PipelineTriggerClient when set)
TriggerPipelineFn func(ns, slug string, input backend.PipelineTriggerInput) (backend.PipelineTriggerResult, error)
// Pipeline schedule methods (Cloud-only; satisfies backend.PipelineScheduleClient when set)
ListPipelineSchedulesFn func(ns, slug string) ([]backend.PipelineSchedule, error)
CreatePipelineScheduleFn func(ns, slug string, input backend.PipelineScheduleInput) (backend.PipelineSchedule, error)
DeletePipelineScheduleFn func(ns, slug, uuid string) error
// Pipeline cache methods (Cloud-only; satisfies backend.PipelineCacheClient when set)
ListPipelineCachesFn func(ns, slug string) ([]backend.PipelineCache, error)
DeletePipelineCacheFn func(ns, slug, uuid string) error
// Diff methods (both backends; satisfies backend.DiffClient when set)
GetDiffFn func(ns, slug, from, to string) (string, error)
GetDiffStatFn func(ns, slug, from, to string) (backend.DiffStat, error)
// PR commit methods (both backends; satisfies backend.PRCommitClient when set)
ListPRCommitsFn func(ns, slug string, prID int) ([]backend.Commit, error)
// PR file methods (both backends; satisfies backend.PRFileClient when set)
ListPRFilesFn func(ns, slug string, prID int) ([]backend.DiffStatEntry, error)
// PR participant methods (both backends; satisfies backend.PRParticipantClient when set)
ListPRParticipantsFn func(ns, slug string, prID int) ([]backend.PRParticipant, error)
// Repo watcher methods (both backends; satisfies backend.RepoWatcherClient when set)
ListRepoWatchersFn func(ns, slug string) ([]backend.User, error)
// Repo forks methods (both backends; satisfies backend.RepoForksLister when set)
ListRepoForksFn func(ns, slug string, limit int) ([]backend.Repository, error)
}
FakeClient is a test double for backend.Client. Set the Fn fields for the methods your test exercises. Unset methods call t.Fatalf so unexpected calls are loud failures.
func (*FakeClient) AddAnnotations ¶ added in v1.23.0
func (c *FakeClient) AddAnnotations(project, slug, hash, key string, in []backend.CodeInsightsAnnotationInput) error
func (*FakeClient) AddBranchRule ¶ added in v1.53.0
func (c *FakeClient) AddBranchRule(ns, slug string, input backend.BranchRuleInput) (backend.BranchRule, error)
func (*FakeClient) AddCommitComment ¶ added in v1.27.0
func (c *FakeClient) AddCommitComment(ns, slug, hash string, in backend.AddCommitCommentInput) (backend.CommitComment, error)
func (*FakeClient) AddDefaultReviewer ¶ added in v1.50.0
func (c *FakeClient) AddDefaultReviewer(ns, slug, userSlug string) error
func (*FakeClient) AddDeployKey ¶ added in v1.47.0
func (c *FakeClient) AddDeployKey(ns, slug string, input backend.DeployKeyInput) (backend.DeployKey, error)
func (*FakeClient) AddIssueComment ¶ added in v1.23.0
func (c *FakeClient) AddIssueComment(ns, slug string, id int, body string) (backend.IssueComment, error)
func (*FakeClient) AddPRComment ¶ added in v1.6.0
func (c *FakeClient) AddPRComment(ns, slug string, id int, in backend.AddPRCommentInput) (backend.PRComment, error)
func (*FakeClient) AddSSHKey ¶ added in v1.51.0
func (c *FakeClient) AddSSHKey(input backend.SSHKeyInput) (backend.SSHKey, error)
func (*FakeClient) AssignIssue ¶ added in v1.23.0
func (c *FakeClient) AssignIssue(ns, slug string, id int, assignee string) error
func (*FakeClient) CreateBranch ¶
func (c *FakeClient) CreateBranch(ns, slug string, in backend.CreateBranchInput) (backend.Branch, error)
func (*FakeClient) CreateBranchProtection ¶ added in v1.17.0
func (c *FakeClient) CreateBranchProtection(ns, slug string, in backend.CreateBranchProtectionInput) (backend.BranchProtection, error)
func (*FakeClient) CreateEnvironment ¶ added in v1.29.0
func (c *FakeClient) CreateEnvironment(ns, slug string, in backend.CreateEnvironmentInput) (backend.Environment, error)
func (*FakeClient) CreateIssue ¶ added in v1.17.0
func (c *FakeClient) CreateIssue(ns, slug string, in backend.CreateIssueInput) (backend.Issue, error)
func (*FakeClient) CreatePR ¶
func (c *FakeClient) CreatePR(ns, slug string, in backend.CreatePRInput) (backend.PullRequest, error)
func (*FakeClient) CreatePipelineSchedule ¶ added in v1.54.0
func (c *FakeClient) CreatePipelineSchedule(ns, slug string, input backend.PipelineScheduleInput) (backend.PipelineSchedule, error)
func (*FakeClient) CreateRepo ¶
func (c *FakeClient) CreateRepo(ns string, in backend.CreateRepoInput) (backend.Repository, error)
func (*FakeClient) CreateReviewerGroup ¶ added in v1.69.0
func (c *FakeClient) CreateReviewerGroup(ns, slug string, in backend.CreateReviewerGroupInput) (backend.ReviewerGroup, error)
func (*FakeClient) CreateTag ¶
func (c *FakeClient) CreateTag(ns, slug string, in backend.CreateTagInput) (backend.Tag, error)
func (*FakeClient) CreateWebhook ¶ added in v1.15.0
func (c *FakeClient) CreateWebhook(ns, slug string, in backend.CreateWebhookInput) (backend.Webhook, error)
func (*FakeClient) CreateWorkspaceWebhook ¶ added in v1.66.0
func (c *FakeClient) CreateWorkspaceWebhook(workspace string, in backend.CreateWebhookInput) (backend.Webhook, error)
func (*FakeClient) DefaultReviewers ¶ added in v1.17.0
func (c *FakeClient) DefaultReviewers(ns, slug, fromBranch, toBranch string) ([]backend.User, error)
DefaultReviewers defaults to "no defaults configured" (nil, nil) when the Fn is unset — unlike most FakeClient methods which Fatalf on unset Fn. Rationale: default-reviewers is a passive lookup automatically triggered by `pr create`, not an action a test deliberately exercises. Most pr-create tests don't care about reviewers and shouldn't be forced to set a stub just to silence the auto-fetch path. Tests that DO assert on the lookup (see create_default_reviewers_test.go) wire DefaultReviewersFn explicitly.
func (*FakeClient) DeleteAnnotations ¶ added in v1.23.0
func (c *FakeClient) DeleteAnnotations(project, slug, hash, key string) error
func (*FakeClient) DeleteBranch ¶
func (c *FakeClient) DeleteBranch(ns, slug, branch string) error
func (*FakeClient) DeleteBranchProtection ¶ added in v1.17.0
func (c *FakeClient) DeleteBranchProtection(ns, slug string, id int) error
func (*FakeClient) DeleteBranchRule ¶ added in v1.53.0
func (c *FakeClient) DeleteBranchRule(ns, slug string, id int) error
func (*FakeClient) DeleteCommitComment ¶ added in v1.27.0
func (c *FakeClient) DeleteCommitComment(ns, slug, hash string, commentID int) error
func (*FakeClient) DeleteDeployKey ¶ added in v1.47.0
func (c *FakeClient) DeleteDeployKey(ns, slug string, id int) error
func (*FakeClient) DeleteEnvVariable ¶ added in v1.29.0
func (c *FakeClient) DeleteEnvVariable(ns, slug, envUUID, varUUID string) error
func (*FakeClient) DeleteEnvironment ¶ added in v1.29.0
func (c *FakeClient) DeleteEnvironment(ns, slug, uuid string) error
func (*FakeClient) DeleteIssueComment ¶ added in v1.23.0
func (c *FakeClient) DeleteIssueComment(ns, slug string, id, commentID int) error
func (*FakeClient) DeleteMergeCheck ¶ added in v1.23.0
func (c *FakeClient) DeleteMergeCheck(project, slug, key string) error
func (*FakeClient) DeletePRComment ¶ added in v1.24.0
func (c *FakeClient) DeletePRComment(ns, slug string, id, commentID int) error
func (*FakeClient) DeletePipelineCache ¶ added in v1.67.0
func (c *FakeClient) DeletePipelineCache(ns, slug, uuid string) error
func (*FakeClient) DeletePipelineSchedule ¶ added in v1.54.0
func (c *FakeClient) DeletePipelineSchedule(ns, slug, uuid string) error
func (*FakeClient) DeletePipelineVariable ¶ added in v1.15.0
func (c *FakeClient) DeletePipelineVariable(ns, slug, key string) error
func (*FakeClient) DeleteRepo ¶
func (c *FakeClient) DeleteRepo(ns, slug string) error
func (*FakeClient) DeleteReport ¶ added in v1.23.0
func (c *FakeClient) DeleteReport(project, slug, hash, key string) error
func (*FakeClient) DeleteReviewerGroup ¶ added in v1.69.0
func (c *FakeClient) DeleteReviewerGroup(ns, slug string, id int) error
func (*FakeClient) DeleteSSHKey ¶ added in v1.51.0
func (c *FakeClient) DeleteSSHKey(id int) error
func (*FakeClient) DeleteTag ¶
func (c *FakeClient) DeleteTag(ns, slug, name string) error
func (*FakeClient) DeleteWebhook ¶ added in v1.15.0
func (c *FakeClient) DeleteWebhook(ns, slug, id string) error
func (*FakeClient) DeleteWorkspaceVariable ¶ added in v1.31.0
func (c *FakeClient) DeleteWorkspaceVariable(ns, key string) error
func (*FakeClient) DeleteWorkspaceWebhook ¶ added in v1.66.0
func (c *FakeClient) DeleteWorkspaceWebhook(workspace, uuid string) error
func (*FakeClient) DisableAutoMerge ¶ added in v1.30.0
func (c *FakeClient) DisableAutoMerge(ns, slug string, id int) error
func (*FakeClient) EditCommitComment ¶ added in v1.27.0
func (c *FakeClient) EditCommitComment(ns, slug, hash string, commentID int, body string) (backend.CommitComment, error)
func (*FakeClient) EditIssueComment ¶ added in v1.23.0
func (c *FakeClient) EditIssueComment(ns, slug string, id, commentID int, body string) (backend.IssueComment, error)
func (*FakeClient) EditPRComment ¶ added in v1.24.0
func (*FakeClient) EnableAutoMerge ¶ added in v1.30.0
func (c *FakeClient) EnableAutoMerge(ns, slug string, id int, strategy string) error
func (*FakeClient) ForkRepo ¶ added in v1.16.0
func (c *FakeClient) ForkRepo(ns, slug string, in backend.ForkRepoInput) (backend.Repository, error)
func (*FakeClient) GetCommit ¶
func (c *FakeClient) GetCommit(ns, slug, hash string) (backend.Commit, error)
func (*FakeClient) GetCurrentUser ¶
func (c *FakeClient) GetCurrentUser() (backend.User, error)
func (*FakeClient) GetDeployment ¶ added in v1.29.0
func (c *FakeClient) GetDeployment(ns, slug, uuid string) (backend.Deployment, error)
func (*FakeClient) GetDiff ¶ added in v1.49.0
func (c *FakeClient) GetDiff(ns, slug, from, to string) (string, error)
func (*FakeClient) GetDiffStat ¶ added in v1.49.0
func (c *FakeClient) GetDiffStat(ns, slug, from, to string) (backend.DiffStat, error)
func (*FakeClient) GetFileContent ¶ added in v1.22.0
func (c *FakeClient) GetFileContent(ns, slug, ref, path string) ([]byte, error)
func (*FakeClient) GetLoggingConfig ¶ added in v1.38.0
func (c *FakeClient) GetLoggingConfig() (backend.LoggingConfig, error)
func (*FakeClient) GetMergeCheck ¶ added in v1.23.0
func (c *FakeClient) GetMergeCheck(project, slug, key string) (backend.MergeCheck, error)
func (*FakeClient) GetPR ¶
func (c *FakeClient) GetPR(ns, slug string, id int) (backend.PullRequest, error)
func (*FakeClient) GetPRActivity ¶ added in v1.26.0
func (c *FakeClient) GetPRActivity(ns, slug string, id int, limit int) ([]backend.PRActivityEvent, error)
func (*FakeClient) GetPRDiff ¶
func (c *FakeClient) GetPRDiff(ns, slug string, id int) (string, error)
func (*FakeClient) GetPipeline ¶
func (c *FakeClient) GetPipeline(ns, slug, uuid string) (backend.Pipeline, error)
func (*FakeClient) GetPipelineStepLog ¶ added in v1.15.0
func (c *FakeClient) GetPipelineStepLog(ns, slug, pipelineUUID, stepUUID string) (io.ReadCloser, error)
func (*FakeClient) GetRepo ¶
func (c *FakeClient) GetRepo(ns, slug string) (backend.Repository, error)
func (*FakeClient) GetReport ¶ added in v1.23.0
func (c *FakeClient) GetReport(project, slug, hash, key string) (backend.CodeInsightsReport, error)
func (*FakeClient) GetWebhook ¶ added in v1.15.0
func (c *FakeClient) GetWebhook(ns, slug, id string) (backend.Webhook, error)
func (*FakeClient) GrantProjectPermission ¶ added in v1.37.0
func (c *FakeClient) GrantProjectPermission(ctx context.Context, project string, subject backend.PermissionSubject, perm string) error
func (*FakeClient) GrantRepoPermission ¶ added in v1.37.0
func (c *FakeClient) GrantRepoPermission(ctx context.Context, project, slug string, subject backend.PermissionSubject, perm string) error
func (*FakeClient) ListAnnotations ¶ added in v1.23.0
func (c *FakeClient) ListAnnotations(project, slug, hash, key string) ([]backend.CodeInsightsAnnotation, error)
func (*FakeClient) ListBranchProtections ¶ added in v1.17.0
func (c *FakeClient) ListBranchProtections(ns, slug string, limit int) ([]backend.BranchProtection, error)
func (*FakeClient) ListBranchRules ¶ added in v1.53.0
func (c *FakeClient) ListBranchRules(ns, slug string) ([]backend.BranchRule, error)
func (*FakeClient) ListBranches ¶
func (*FakeClient) ListCommitComments ¶ added in v1.27.0
func (c *FakeClient) ListCommitComments(ns, slug, hash string, limit int) ([]backend.CommitComment, error)
func (*FakeClient) ListCommitFiles ¶ added in v1.55.0
func (c *FakeClient) ListCommitFiles(ns, slug, hash string) ([]backend.DiffStatEntry, error)
func (*FakeClient) ListCommitStatuses ¶ added in v1.6.0
func (c *FakeClient) ListCommitStatuses(ns, slug, hash string) ([]backend.CommitStatus, error)
func (*FakeClient) ListCommits ¶
func (*FakeClient) ListDefaultReviewers ¶ added in v1.50.0
func (c *FakeClient) ListDefaultReviewers(ns, slug string) ([]backend.DefaultReviewer, error)
func (*FakeClient) ListDeployKeys ¶ added in v1.47.0
func (c *FakeClient) ListDeployKeys(ns, slug string) ([]backend.DeployKey, error)
func (*FakeClient) ListDeployments ¶ added in v1.29.0
func (c *FakeClient) ListDeployments(ns, slug string, limit int) ([]backend.Deployment, error)
func (*FakeClient) ListEnvVariables ¶ added in v1.29.0
func (c *FakeClient) ListEnvVariables(ns, slug, envUUID string) ([]backend.EnvVariable, error)
func (*FakeClient) ListEnvironments ¶ added in v1.29.0
func (c *FakeClient) ListEnvironments(ns, slug string) ([]backend.Environment, error)
func (*FakeClient) ListIssueComments ¶ added in v1.23.0
func (c *FakeClient) ListIssueComments(ns, slug string, id int) ([]backend.IssueComment, error)
func (*FakeClient) ListIssues ¶ added in v1.17.0
func (*FakeClient) ListMyPRs ¶ added in v1.28.0
func (c *FakeClient) ListMyPRs(ns, slug string) ([]backend.MyPREntry, error)
func (*FakeClient) ListPRComments ¶ added in v1.6.0
func (*FakeClient) ListPRCommits ¶ added in v1.56.0
func (*FakeClient) ListPRFiles ¶ added in v1.57.0
func (c *FakeClient) ListPRFiles(ns, slug string, prID int) ([]backend.DiffStatEntry, error)
func (*FakeClient) ListPRParticipants ¶ added in v1.60.0
func (c *FakeClient) ListPRParticipants(ns, slug string, prID int) ([]backend.PRParticipant, error)
func (*FakeClient) ListPRs ¶
func (c *FakeClient) ListPRs(ns, slug, state string, limit int) ([]backend.PullRequest, error)
func (*FakeClient) ListPipelineCaches ¶ added in v1.67.0
func (c *FakeClient) ListPipelineCaches(ns, slug string) ([]backend.PipelineCache, error)
func (*FakeClient) ListPipelineSchedules ¶ added in v1.54.0
func (c *FakeClient) ListPipelineSchedules(ns, slug string) ([]backend.PipelineSchedule, error)
func (*FakeClient) ListPipelineSteps ¶ added in v1.15.0
func (c *FakeClient) ListPipelineSteps(ns, slug, uuid string) ([]backend.PipelineStep, error)
func (*FakeClient) ListPipelineVariables ¶ added in v1.15.0
func (c *FakeClient) ListPipelineVariables(ns, slug string) ([]backend.PipelineVariable, error)
func (*FakeClient) ListPipelines ¶
func (*FakeClient) ListProjectPermissions ¶ added in v1.37.0
func (c *FakeClient) ListProjectPermissions(ctx context.Context, project string) ([]backend.PermissionGrant, error)
func (*FakeClient) ListProjects ¶ added in v1.17.0
func (*FakeClient) ListRepoForks ¶ added in v1.64.0
func (c *FakeClient) ListRepoForks(ns, slug string, limit int) ([]backend.Repository, error)
func (*FakeClient) ListRepoPermissions ¶ added in v1.37.0
func (c *FakeClient) ListRepoPermissions(ctx context.Context, project, slug string) ([]backend.PermissionGrant, error)
func (*FakeClient) ListRepoWatchers ¶ added in v1.58.0
func (c *FakeClient) ListRepoWatchers(ns, slug string) ([]backend.User, error)
func (*FakeClient) ListReports ¶ added in v1.23.0
func (c *FakeClient) ListReports(project, slug, hash string) ([]backend.CodeInsightsReport, error)
func (*FakeClient) ListRepos ¶
func (c *FakeClient) ListRepos(ns string, limit int) ([]backend.Repository, error)
func (*FakeClient) ListReviewerGroups ¶ added in v1.69.0
func (c *FakeClient) ListReviewerGroups(ns, slug string) ([]backend.ReviewerGroup, error)
func (*FakeClient) ListSSHKeys ¶ added in v1.51.0
func (c *FakeClient) ListSSHKeys() ([]backend.SSHKey, error)
func (*FakeClient) ListTree ¶ added in v1.22.0
func (c *FakeClient) ListTree(ns, slug, ref, path string) ([]backend.TreeEntry, error)
func (*FakeClient) ListWebhooks ¶ added in v1.15.0
func (c *FakeClient) ListWebhooks(ns, slug string) ([]backend.Webhook, error)
func (*FakeClient) ListWorkspaceMembers ¶ added in v1.62.0
func (c *FakeClient) ListWorkspaceMembers(workspace string, limit int) ([]backend.WorkspaceMember, error)
func (*FakeClient) ListWorkspaceVariables ¶ added in v1.31.0
func (c *FakeClient) ListWorkspaceVariables(ns string) ([]backend.PipelineVariable, error)
func (*FakeClient) ListWorkspaceWebhooks ¶ added in v1.66.0
func (c *FakeClient) ListWorkspaceWebhooks(workspace string) ([]backend.Webhook, error)
func (*FakeClient) ListWorkspaces ¶ added in v1.17.0
func (c *FakeClient) ListWorkspaces(limit int) ([]backend.Workspace, error)
func (*FakeClient) MergePR ¶
func (c *FakeClient) MergePR(ns, slug string, id int, in backend.MergePRInput) (backend.PullRequest, error)
func (*FakeClient) RemoveDefaultReviewer ¶ added in v1.50.0
func (c *FakeClient) RemoveDefaultReviewer(ns, slug, userSlug string) error
func (*FakeClient) RemoveReviewers ¶ added in v1.76.0
func (c *FakeClient) RemoveReviewers(ns, slug string, id int, users []string) error
func (*FakeClient) RenameRepo ¶ added in v1.16.0
func (c *FakeClient) RenameRepo(ns, slug, newName string) (backend.Repository, error)
func (*FakeClient) ReopenIssue ¶ added in v1.23.0
func (c *FakeClient) ReopenIssue(ns, slug string, id int) error
func (*FakeClient) ReportCommitStatus ¶ added in v1.59.0
func (c *FakeClient) ReportCommitStatus(ns, slug, hash string, input backend.CommitStatusInput) (backend.CommitStatus, error)
func (*FakeClient) RequestReview ¶
func (c *FakeClient) RequestReview(ns, slug string, id int, users []string) error
func (*FakeClient) RevokeProjectPermission ¶ added in v1.37.0
func (c *FakeClient) RevokeProjectPermission(ctx context.Context, project string, subject backend.PermissionSubject) error
func (*FakeClient) RevokeRepoPermission ¶ added in v1.37.0
func (c *FakeClient) RevokeRepoPermission(ctx context.Context, project, slug string, subject backend.PermissionSubject) error
func (*FakeClient) RotateSecrets ¶ added in v1.38.0
func (c *FakeClient) RotateSecrets() error
func (*FakeClient) RunPipeline ¶
func (c *FakeClient) RunPipeline(ns, slug string, in backend.RunPipelineInput) (backend.Pipeline, error)
func (*FakeClient) SearchCode ¶ added in v1.21.0
func (c *FakeClient) SearchCode(workspace, query string, limit int) ([]backend.CodeSearchHit, error)
func (*FakeClient) SetEnvVariable ¶ added in v1.29.0
func (c *FakeClient) SetEnvVariable(ns, slug, envUUID string, in backend.EnvVariableInput) (backend.EnvVariable, error)
func (*FakeClient) SetLoggingConfig ¶ added in v1.38.0
func (c *FakeClient) SetLoggingConfig(in backend.LoggingConfigInput) error
func (*FakeClient) SetMergeCheck ¶ added in v1.23.0
func (c *FakeClient) SetMergeCheck(project, slug, key string, in backend.MergeCheckInput) error
func (*FakeClient) SetPipelineVariable ¶ added in v1.15.0
func (c *FakeClient) SetPipelineVariable(ns, slug string, in backend.PipelineVariableInput) (backend.PipelineVariable, error)
func (*FakeClient) SetRepoVisibility ¶ added in v1.65.0
func (c *FakeClient) SetRepoVisibility(ns, slug string, isPrivate bool) error
func (*FakeClient) SetReport ¶ added in v1.23.0
func (c *FakeClient) SetReport(project, slug, hash, key string, in backend.CodeInsightsReportInput) (backend.CodeInsightsReport, error)
func (*FakeClient) SetWorkspaceVariable ¶ added in v1.31.0
func (c *FakeClient) SetWorkspaceVariable(ns string, in backend.PipelineVariableInput) (backend.PipelineVariable, error)
func (*FakeClient) SubmitReview ¶ added in v1.25.0
func (c *FakeClient) SubmitReview(ns, slug string, id int, in backend.SubmitReviewInput) error
func (*FakeClient) TransferRepo ¶ added in v1.52.0
func (c *FakeClient) TransferRepo(ns, slug, target string) (backend.Repository, error)
func (*FakeClient) TriggerPipeline ¶ added in v1.48.0
func (c *FakeClient) TriggerPipeline(ns, slug string, input backend.PipelineTriggerInput) (backend.PipelineTriggerResult, error)
func (*FakeClient) UnapprovePR ¶
func (c *FakeClient) UnapprovePR(ns, slug string, id int) error
func (*FakeClient) UnreadyPR ¶ added in v1.75.0
func (c *FakeClient) UnreadyPR(ns, slug string, id int) error
func (*FakeClient) UpdateIssue ¶ added in v1.17.0
func (c *FakeClient) UpdateIssue(ns, slug string, id int, in backend.UpdateIssueInput) (backend.Issue, error)
func (*FakeClient) UpdatePR ¶
func (c *FakeClient) UpdatePR(ns, slug string, id int, in backend.UpdatePRInput) (backend.PullRequest, error)
func (*FakeClient) UpdatePRBranch ¶ added in v1.28.0
func (c *FakeClient) UpdatePRBranch(ns, slug string, prID int) error
type FakeEditorLauncher ¶
FakeEditorLauncher is a test double for an editor.Launcher. When Edit is called it records the filename, writes Content to the file, and returns Err.
func (*FakeEditorLauncher) Edit ¶
func (e *FakeEditorLauncher) Edit(filename string) error
Edit records the filename and (if Err is nil) writes Content into it.
type FakeKeyring ¶
type FakeKeyring struct {
GetErr error
SetErr error
DelErr error
// contains filtered or unexported fields
}
FakeKeyring is an in-memory test double for a system keyring.
func NewFakeKeyring ¶
func NewFakeKeyring() *FakeKeyring
NewFakeKeyring returns an empty FakeKeyring.
func (*FakeKeyring) Delete ¶
func (k *FakeKeyring) Delete(service, user string) error
Delete removes a stored password. If DelErr is set it is returned.
func (*FakeKeyring) Get ¶
func (k *FakeKeyring) Get(service, user string) (string, error)
Get returns the stored password or an error. If GetErr is set it is returned. Missing entries return a "not found" error.
func (*FakeKeyring) Set ¶
func (k *FakeKeyring) Set(service, user, password string) error
Set stores a password. If SetErr is set it is returned.
type FakeRunner ¶
type FakeRunner struct {
Calls []Call
// BitbottleConfig overrides answers for `git config --local --get
// bitbottle.<key>` lookups. Tests that exercise the pinned-default-repo
// path populate this map; legacy tests leave it nil and bitbottle.* reads
// resolve to "missing" without consuming a queued response.
BitbottleConfig map[string]string
// contains filtered or unexported fields
}
FakeRunner is a test double for a git command runner.
func NewFakeRunner ¶
func NewFakeRunner(responses ...RunResponse) *FakeRunner
NewFakeRunner constructs a FakeRunner seeded with the provided responses. Responses are consumed in order; if the runner is called more times than there are responses the extras return zero values.
func (*FakeRunner) AssertCalled ¶
func (r *FakeRunner) AssertCalled(t testing.TB, args ...string)
AssertCalled fails t if no recorded call matches the supplied args exactly.
func (*FakeRunner) AssertNotCalled ¶
func (r *FakeRunner) AssertNotCalled(t testing.TB, args ...string)
AssertNotCalled fails t if any recorded call matches the supplied args.
func (*FakeRunner) Run ¶
func (r *FakeRunner) Run(args ...string) (string, string, error)
Run records the call and returns the next canned response.
Reads of bitbottle.* keys via `git config --local --get bitbottle.<name>` are answered as "missing" (empty stdout, no error) without consuming a queued response. This lets pre-existing tests that seed responses only for the legacy git-remote inference path continue to work after the factory gained a `bitbottle repo set-default` consult step. Tests that intentionally exercise the pinned-default path supply explicit responses; their first `bitbottle.host` lookup matches the queued stdout before this shortcut fires.
func (*FakeRunner) RunInteractive ¶
func (r *FakeRunner) RunInteractive(args ...string) error
RunInteractive records the call (flagged as interactive) and returns only the error from the next canned response.
type IOStreams ¶
type IOStreams struct {
In io.ReadCloser
Out io.Writer
ErrOut io.Writer
IsStdoutTTY func() bool
IsStderrTTY func() bool
ColorEnabled bool
}
IOStreams is a test double for pkg/iostreams.IOStreams. It will be replaced with the real import once pkg/iostreams exists.
func TTYIOStreams ¶
TTYIOStreams returns an IOStreams that claims stdout and stderr are TTYs and has color enabled.
type PROption ¶
PROption mutates a Bitbucket pull request fixture.
func PRWithBaseBranch ¶
PRWithBaseBranch sets toRef to the given destination branch.
func PRWithBranch ¶
PRWithBranch sets fromRef to the given source branch.
func PRWithState ¶
PRWithState sets the PR state (OPEN, MERGED, DECLINED).
type RepoOption ¶
RepoOption mutates a Bitbucket repository fixture.
func RepoWithProject ¶
func RepoWithProject(key string) RepoOption
RepoWithProject sets the nested project.key field.
func RepoWithSlug ¶
func RepoWithSlug(slug string) RepoOption
RepoWithSlug sets the slug and name fields of the repo.
type RunResponse ¶
RunResponse is a canned result for a single Run/RunInteractive invocation.
type StubResponse ¶
type StubResponse struct {
Method string
PathSuffix string
Status int
Body any
Handler http.HandlerFunc
}
StubResponse describes a single canned HTTP response for NewTestServer. If Handler is set it takes precedence over Status/Body.