Honor validated registration usernames
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s

This commit is contained in:
tegwick 2026-08-10 13:23:45 +02:00
parent 83508915db
commit 0be8a03b99
2 changed files with 16 additions and 2 deletions

View file

@ -19,6 +19,13 @@ class ProvisionerTests(unittest.TestCase):
def test_username_is_stable_and_sanitized(self):
self.assertEqual("bernd.worsch", _username("Bernd.Worsch@binky-hedgehog.com"))
def test_preferred_username_is_honored_and_validated(self):
self.assertEqual("chosen.name", _username("other@example.test", "Chosen.Name"))
with self.assertRaisesRegex(ValueError, "invalid"):
_username("other@example.test", "not allowed!")
with self.assertRaisesRegex(ValueError, "reserved"):
_username("other@example.test", "admin")
def test_dispatch_requires_idempotency(self):
with self.assertRaisesRegex(ValueError, "idempotency_key"):
dispatch(Fake(), "/v1/identities/suspend", {