()
| 522 | } |
| 523 | |
| 524 | func (s *GithubTestSuite) TestGetGithubCredentials() { |
| 525 | ctx := garmTesting.ImpersonateAdminContext(context.Background(), s.db, s.T()) |
| 526 | |
| 527 | credParams := params.CreateGithubCredentialsParams{ |
| 528 | Name: testCredsName, |
| 529 | Description: testCredsDescription, |
| 530 | Endpoint: defaultGithubEndpoint, |
| 531 | AuthType: params.ForgeAuthTypePAT, |
| 532 | PAT: params.GithubPAT{ |
| 533 | OAuth2Token: "test", |
| 534 | }, |
| 535 | } |
| 536 | |
| 537 | creds, err := s.db.CreateGithubCredentials(ctx, credParams) |
| 538 | s.Require().NoError(err) |
| 539 | s.Require().NotNil(creds) |
| 540 | |
| 541 | creds2, err := s.db.GetGithubCredentialsByName(ctx, testCredsName, true) |
| 542 | s.Require().NoError(err) |
| 543 | s.Require().NotNil(creds2) |
| 544 | s.Require().Equal(creds.Name, creds2.Name) |
| 545 | s.Require().Equal(creds.ID, creds2.ID) |
| 546 | |
| 547 | creds2, err = s.db.GetGithubCredentials(ctx, creds.ID, true) |
| 548 | s.Require().NoError(err) |
| 549 | s.Require().NotNil(creds2) |
| 550 | s.Require().Equal(creds.Name, creds2.Name) |
| 551 | s.Require().Equal(creds.ID, creds2.ID) |
| 552 | } |
| 553 | |
| 554 | func (s *GithubTestSuite) TestDeleteGithubCredentials() { |
| 555 | ctx := garmTesting.ImpersonateAdminContext(context.Background(), s.db, s.T()) |
nothing calls this directly
no test coverage detected