Documentation
¶
Index ¶
- func CountByMethodAndURLRegexp(method string, urlRE *regexp.Regexp) int
- func DumpHttpmockCalls(t testing.TB)
- func EnvOwnerRepo(t testing.TB) (string, string)
- func GetRefGetCount(owner, repo, branch string) int
- func MakeChanged(status, path string) types.ChangedFile
- func MockContentsEndpoint(owner, repo, path, contentB64 string)
- func MockCreateRef(owner, repo string) string
- func MockDeleteTempRef(owner, repo string)
- func MockGetCommit(owner, repo, commitSHA, baseTreeSHA string)
- func MockGitHubAppInstallations(orgToInstallationID map[string]string)
- func MockGitHubAppTokenEndpoint(installationID string)
- func MockGitHubWriteEndpoints(owner, repo, branch string) (baseRefURL, commitsURL, updateRefURL string)
- func MockGitHubWriteEndpointsNoOp(owner, repo, branch string) (baseRefURL, commitsURL, updateRefURL string)
- func MockListOpenPRs(owner, repo string, prs []map[string]any)
- func MockPullsAndMerge(owner, repo string, number int)
- func NormalizeUpload(in map[types.UploadKey]types.UploadFileContent) map[types.UploadKey][]string
- func SetupOrgToken(org, token string)
- func TestConfig() *configs.Config
- func WithHTTPMock(t testing.TB) *http.Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountByMethodAndURLRegexp ¶
CountByMethodAndURLRegexp adds up call counts for a given METHOD whose stored httpmock key's URL matches urlRE.
func DumpHttpmockCalls ¶
DumpHttpmockCalls logs all recorded httpmock keys and counts. Used for debugging while writing tests.
func EnvOwnerRepo ¶
EnvOwnerRepo returns config repo owner/name from env and fails the test if either is missing.
func GetRefGetCount ¶
GetRefGetCount counts GET calls to /git/ref/(refs/)?heads/<branch> for the given owner/repo/branch.
func MakeChanged ¶
func MakeChanged(status, path string) types.ChangedFile
MakeChanged is a shorthand to build ChangedFile entries.
func MockContentsEndpoint ¶
func MockContentsEndpoint(owner, repo, path, contentB64 string)
MockContentsEndpoint mocks GET file contents for a given path/ref.
func MockCreateRef ¶
MockCreateRef mocks POST to create a new temp branch ref. Returns the exact URL for call-count asserts.
func MockDeleteTempRef ¶
func MockDeleteTempRef(owner, repo string)
MockDeleteTempRef mocks DELETE to remove a temporary branch ref.
func MockGetCommit ¶
func MockGetCommit(owner, repo, commitSHA, baseTreeSHA string)
MockGetCommit mocks GET /repos/{owner}/{repo}/git/commits/{sha} for tree comparison. baseTreeSHA is the tree SHA of the base commit; use a value different from the new tree to allow commits, or the same value to simulate a no-op.
func MockGitHubAppInstallations ¶
MockGitHubAppInstallations mocks the GitHub App installations list endpoint.
func MockGitHubAppTokenEndpoint ¶
func MockGitHubAppTokenEndpoint(installationID string)
MockGitHubAppTokenEndpoint mocks the GitHub App installation token endpoint with a fixed fake token.
func MockGitHubWriteEndpoints ¶
func MockGitHubWriteEndpoints(owner, repo, branch string) (baseRefURL, commitsURL, updateRefURL string)
MockGitHubWriteEndpoints mocks the full direct-commit flow endpoints for a single branch. Returns the URLs for the base ref, commits, and update ref endpoints. The base commit's tree SHA is "oldTreeSha" (different from the new tree "newTreeSha"), so commits will proceed normally. Use MockGitHubWriteEndpointsNoOp to simulate no changes.
func MockGitHubWriteEndpointsNoOp ¶
func MockGitHubWriteEndpointsNoOp(owner, repo, branch string) (baseRefURL, commitsURL, updateRefURL string)
MockGitHubWriteEndpointsNoOp is like MockGitHubWriteEndpoints but the new tree SHA equals the base commit's tree SHA, simulating a no-op (duplicate) commit.
func MockListOpenPRs ¶
MockListOpenPRs mocks the "list open PRs" endpoint, returning the supplied PRs. Pass nil or empty to simulate no existing open PRs.
func MockPullsAndMerge ¶
MockPullsAndMerge mocks creating and merging a PR.
func NormalizeUpload ¶
NormalizeUpload flattens a FilesToUpload map to UploadKey -> []names for simpler comparisons.
func SetupOrgToken ¶
func SetupOrgToken(org, token string)
SetupOrgToken sets up a cached installation token for an organization. This bypasses the need to mock the installations and token endpoints.
func TestConfig ¶
TestConfig returns a *configs.Config populated from the current environment variables. This mirrors the values set in TestMain for test suites.
Types ¶
This section is empty.