1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
|