(t *testing.T)
| 207 | } |
| 208 | |
| 209 | func 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 | |
| 236 | func TestRunUpgradeForOrgRepoFilter(t *testing.T) { |
| 237 | origSearch := searchOrgLockWorkflowReposFn |
nothing calls this directly
no test coverage detected