MCPcopy Create free account
hub / github.com/github/gh-aw / TestRunUpgradeForOrgCreatePR

Function TestRunUpgradeForOrgCreatePR

pkg/cli/upgrade_org_test.go:209–234  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

207}
208
209func TestRunUpgradeForOrgCreatePR(t *testing.T) {
210 origSearch := searchOrgLockWorkflowReposFn
211 origScan := scanUpgradeRepoFn
212 origUpgrade := runUpgradeForTargetRepoFn
213 origWait := waitForOrgRateLimitFn
214 searchOrgLockWorkflowReposFn = func(ctx context.Context, org string, verbose bool) ([]string, error) {
215 return []string{"octo/api", "octo/web"}, nil
216 }
217 scanUpgradeRepoFn = mockScanUpgradeRepo
218 var upgraded []string
219 runUpgradeForTargetRepoFn = func(ctx context.Context, repo string, opts upgradeOptions, verbose bool) error {
220 upgraded = append(upgraded, repo)
221 return nil
222 }
223 waitForOrgRateLimitFn = func(ctx context.Context, resource string, verbose bool) error { return nil }
224 defer func() {
225 searchOrgLockWorkflowReposFn = origSearch
226 scanUpgradeRepoFn = origScan
227 runUpgradeForTargetRepoFn = origUpgrade
228 waitForOrgRateLimitFn = origWait
229 }()
230
231 err := runUpgradeForOrg(context.Background(), "octo", nil, upgradeOptions{ctx: context.Background(), yes: true}, true, false, false)
232 require.NoError(t, err)
233 assert.Equal(t, []string{"octo/api", "octo/web"}, upgraded)
234}
235
236func TestRunUpgradeForOrgRepoFilter(t *testing.T) {
237 origSearch := searchOrgLockWorkflowReposFn

Callers

nothing calls this directly

Calls 2

runUpgradeForOrgFunction · 0.85
BackgroundMethod · 0.80

Tested by

no test coverage detected