aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-10-21 00:28:26 +0300
committerEgor Tensin <egor@tensin.name>2026-10-21 00:29:30 +0300
commit27c7a3cb65355a1d87eb91bb21827974268b7622 (patch)
tree674ad9c7412c65c48078f1e006e3f86f6e82017d
parentworkflows/ci: run zizmor on linting (diff)
downloadcgitize-27c7a3cb65355a1d87eb91bb21827974268b7622.tar.gz
cgitize-27c7a3cb65355a1d87eb91bb21827974268b7622.zip
t/u: add test for Bitbucket username auth
-rw-r--r--test/unit/test_bitbucket.py16
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")