(t *testing.T)
| 433 | } |
| 434 | |
| 435 | func Test_removeRun_org(t *testing.T) { |
| 436 | tests := []struct { |
| 437 | name string |
| 438 | opts *DeleteOptions |
| 439 | wantPath string |
| 440 | }{ |
| 441 | { |
| 442 | name: "org", |
| 443 | opts: &DeleteOptions{ |
| 444 | OrgName: "UmbrellaCorporation", |
| 445 | }, |
| 446 | wantPath: "orgs/UmbrellaCorporation/actions/secrets/tVirus", |
| 447 | }, |
| 448 | { |
| 449 | name: "Dependabot org", |
| 450 | opts: &DeleteOptions{ |
| 451 | Application: "dependabot", |
| 452 | OrgName: "UmbrellaCorporation", |
| 453 | }, |
| 454 | wantPath: "orgs/UmbrellaCorporation/dependabot/secrets/tVirus", |
| 455 | }, |
| 456 | { |
| 457 | name: "Codespaces org", |
| 458 | opts: &DeleteOptions{ |
| 459 | Application: "codespaces", |
| 460 | OrgName: "UmbrellaCorporation", |
| 461 | }, |
| 462 | wantPath: "orgs/UmbrellaCorporation/codespaces/secrets/tVirus", |
| 463 | }, |
| 464 | { |
| 465 | name: "Agents org", |
| 466 | opts: &DeleteOptions{ |
| 467 | Application: "agents", |
| 468 | OrgName: "UmbrellaCorporation", |
| 469 | }, |
| 470 | wantPath: "orgs/UmbrellaCorporation/agents/secrets/tVirus", |
| 471 | }, |
| 472 | } |
| 473 | |
| 474 | for _, tt := range tests { |
| 475 | t.Run(tt.name, func(t *testing.T) { |
| 476 | reg := &httpmock.Registry{} |
| 477 | |
| 478 | reg.Register( |
| 479 | httpmock.REST("DELETE", tt.wantPath), |
| 480 | httpmock.StatusStringResponse(204, "No Content")) |
| 481 | |
| 482 | ios, _, _, _ := iostreams.Test() |
| 483 | |
| 484 | tt.opts.Config = func() (gh.Config, error) { |
| 485 | return config.NewBlankConfig(), nil |
| 486 | } |
| 487 | tt.opts.BaseRepo = func() (ghrepo.Interface, error) { |
| 488 | return ghrepo.FromFullName("owner/repo") |
| 489 | } |
| 490 | tt.opts.HttpClient = func() (*http.Client, error) { |
| 491 | return &http.Client{Transport: reg}, nil |
| 492 | } |
nothing calls this directly
no test coverage detected