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

Function TestRunUpgradeForOrgCreateIssue

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

Source from the content-addressed store, hash-verified

261}
262
263func TestRunUpgradeForOrgCreateIssue(t *testing.T) {
264 origSearch := searchOrgLockWorkflowReposFn
265 origScan := scanUpgradeRepoFn
266 origUpgrade := runUpgradeForTargetRepoFn
267 origWait := waitForOrgRateLimitFn
268 origIssue := createIssueForUpgradeOrgRepoFn
269 searchOrgLockWorkflowReposFn = func(ctx context.Context, org string, verbose bool) ([]string, error) {
270 return []string{"octo/api", "octo/web"}, nil
271 }
272 scanUpgradeRepoFn = mockScanUpgradeRepo
273 runUpgradeForTargetRepoFn = func(ctx context.Context, repo string, opts upgradeOptions, verbose bool) error {
274 t.Fatalf("unexpected upgrade call for %s", repo)
275 return nil
276 }
277 var issuedRepos []string
278 createIssueForUpgradeOrgRepoFn = func(ctx context.Context, repo string, verbose bool) error {
279 issuedRepos = append(issuedRepos, repo)
280 return nil
281 }
282 waitForOrgRateLimitFn = func(ctx context.Context, resource string, verbose bool) error { return nil }
283 defer func() {
284 searchOrgLockWorkflowReposFn = origSearch
285 scanUpgradeRepoFn = origScan
286 runUpgradeForTargetRepoFn = origUpgrade
287 waitForOrgRateLimitFn = origWait
288 createIssueForUpgradeOrgRepoFn = origIssue
289 }()
290
291 err := runUpgradeForOrg(context.Background(), "octo", nil, upgradeOptions{ctx: context.Background(), yes: true}, false, true, false)
292 require.NoError(t, err)
293 assert.Equal(t, []string{"octo/api", "octo/web"}, issuedRepos)
294}
295
296func TestRunUpgradeCommandCreateIssueRequiresOrg(t *testing.T) {
297 cmd := NewUpgradeCommand()

Callers

nothing calls this directly

Calls 2

runUpgradeForOrgFunction · 0.85
BackgroundMethod · 0.80

Tested by

no test coverage detected