diff options
| author | Egor Tensin <egor@tensin.name> | 2026-10-21 00:28:26 +0300 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-10-21 00:29:30 +0300 |
| commit | 27c7a3cb65355a1d87eb91bb21827974268b7622 (patch) | |
| tree | 674ad9c7412c65c48078f1e006e3f86f6e82017d /test/unit/test_bitbucket.py | |
| parent | workflows/ci: run zizmor on linting (diff) | |
| download | cgitize-27c7a3cb65355a1d87eb91bb21827974268b7622.tar.gz cgitize-27c7a3cb65355a1d87eb91bb21827974268b7622.zip | |
t/u: add test for Bitbucket username auth
Diffstat (limited to 'test/unit/test_bitbucket.py')
| -rw-r--r-- | test/unit/test_bitbucket.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/test_bitbucket.py b/test/unit/test_bitbucket.py index edf3f98..99e3f8e 100644 --- a/test/unit/test_bitbucket.py +++ b/test/unit/test_bitbucket.py @@ -18,6 +18,22 @@ class BitbucketTests(unittest.TestCase): cloud=True, ) + def test_username_auth(self): + # Bitbucket, at one point, switched from authenticating with a username + # to using the Atlassian email address. + bb = Cloud( + username="cgitize-test", + password=os.environ.get("CGITIZE_BITBUCKET_TOKEN"), + cloud=True, + ) + # So, authenticating with the username should fail: + with self.assertRaises(HTTPError) as ctx: + bb.repositories.get("cgitize-test-workspace", "private") + + expected = "API token must be used with an atlassian registered email" + actual = str(ctx.exception) + self.assertEqual(expected, actual) + def test_nonexistent_repo(self): with self.assertRaises(HTTPError): self.bitbucket.repositories.get("doesnot", "exist") |
