()
| 552 | } |
| 553 | |
| 554 | func (s *GithubTestSuite) TestDeleteGithubCredentials() { |
| 555 | ctx := garmTesting.ImpersonateAdminContext(context.Background(), s.db, s.T()) |
| 556 | |
| 557 | credParams := params.CreateGithubCredentialsParams{ |
| 558 | Name: testCredsName, |
| 559 | Description: testCredsDescription, |
| 560 | Endpoint: defaultGithubEndpoint, |
| 561 | AuthType: params.ForgeAuthTypePAT, |
| 562 | PAT: params.GithubPAT{ |
| 563 | OAuth2Token: "test", |
| 564 | }, |
| 565 | } |
| 566 | |
| 567 | creds, err := s.db.CreateGithubCredentials(ctx, credParams) |
| 568 | s.Require().NoError(err) |
| 569 | s.Require().NotNil(creds) |
| 570 | |
| 571 | err = s.db.DeleteGithubCredentials(ctx, creds.ID) |
| 572 | s.Require().NoError(err) |
| 573 | |
| 574 | _, err = s.db.GetGithubCredentials(ctx, creds.ID, true) |
| 575 | s.Require().Error(err) |
| 576 | s.Require().ErrorIs(err, runnerErrors.ErrNotFound) |
| 577 | } |
| 578 | |
| 579 | func (s *GithubTestSuite) TestDeleteGithubCredentialsByNonAdminUser() { |
| 580 | ctx := garmTesting.ImpersonateAdminContext(context.Background(), s.db, s.T()) |
nothing calls this directly
no test coverage detected