diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-01 13:37:38 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-01 13:37:38 +0200 |
| commit | 7ca80a47dd8ff529951f59ef586c511e4debb057 (patch) | |
| tree | 4d2d8b29ed03116327f88a88c89d4df84dbfb2f4 /packages/meshbay-hub/tests/test_username_case.py | |
| parent | aeec8ee7c9e39704433d93c82fafc0f5721d6fbf (diff) | |
| download | meshbay-7ca80a47dd8ff529951f59ef586c511e4debb057.tar.gz | |
fix(hub): a username is unique whatever its case
Registration refuses a name that differs from an existing one only by case;
accounts that already do keep their names, and a pending retry needs the exact
name (F-26).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests/test_username_case.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_username_case.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_username_case.py b/packages/meshbay-hub/tests/test_username_case.py new file mode 100644 index 0000000..42f4815 --- /dev/null +++ b/packages/meshbay-hub/tests/test_username_case.py @@ -0,0 +1,24 @@ +""" +A username is unique whatever its case. + +Invitations and member management name people by username, so "Alice" beside +"alice" is one person to whoever reads the list — and a second account under +the other spelling is the way to be mistaken for them. +""" + +import pytest +from test_bundle_pepper import KEY + + +async def _register(client, username, email): + return await client.post("/v1/users/register", json={ + "username": username, "auth_key": KEY, "email": email}) + + +@pytest.mark.asyncio +async def test_a_name_differing_only_by_case_is_taken(client): + assert (await _register(client, "alice_case", "a1@example.invalid")).status_code == 201 + for other in ("Alice_case", "ALICE_CASE", "alice_CASE"): + r = await _register(client, other, "a2@example.invalid") + assert r.status_code == 409, (other, r.text) + |