(self, encrypt)
| 646 | |
| 647 | @mock.patch("github.PublicKey.encrypt") |
| 648 | def testRepoSecrets(self, encrypt): |
| 649 | # encrypt returns a non-deterministic value, we need to mock it so the replay data matches |
| 650 | encrypt.return_value = "M+5Fm/BqTfB90h3nC7F3BoZuu3nXs+/KtpXwxm9gG211tbRo0F5UiN0OIfYT83CKcx9oKES9Va4E96/b" |
| 651 | # GitHub will always capitalize the secret name |
| 652 | secrets = (("SECRET_NAME_ONE", "secret-value-one"), ("SECRET_NAME_TWO", "secret-value-two")) |
| 653 | repo = self.g.get_repo("AndrewJDawes/PyGithub") |
| 654 | for matched_repo_secret in secrets: |
| 655 | repo.create_secret(matched_repo_secret[0], matched_repo_secret[1]) |
| 656 | repo.update() |
| 657 | repo_secrets = repo.get_secrets() |
| 658 | matched_repo_secrets = [] |
| 659 | for matched_repo_secret in secrets: |
| 660 | for repo_secret in repo_secrets: |
| 661 | # GitHub will always capitalize the secret name, may be best to uppercase test data for comparison |
| 662 | if repo_secret.name == matched_repo_secret[0].upper(): |
| 663 | matched_repo_secrets.append(repo_secret) |
| 664 | break |
| 665 | self.assertEqual(len(matched_repo_secrets), len(secrets)) |
| 666 | for matched_repo_secret in matched_repo_secrets: |
| 667 | matched_repo_secret.delete() |
| 668 | |
| 669 | def testLazySecret(self): |
| 670 | secret = self.g.withLazy(True).get_repo("lazy/repo").get_secret("secret name") |
nothing calls this directly
no test coverage detected