aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_public_groups_toggle.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-15 02:16:39 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-15 02:21:01 +0200
commitbdefcd025604f2c3009fe5e0cc01213c2ba62a6a (patch)
treeeebd34aa234a9148045ca25b00bf7c8039e00ccf /packages/meshbay-hub/tests/test_public_groups_toggle.py
parent027e7d55f3bb57ba5150fd77e8f0114a0baf8d5c (diff)
downloadmeshbay-bdefcd025604f2c3009fe5e0cc01213c2ba62a6a.tar.gz
feat(hub): usernames are at least 8 characters at registration
Existing shorter accounts keep signing in. Test usernames padded to match. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XuNrwLf5EFWCMHzfoEvnpm
Diffstat (limited to 'packages/meshbay-hub/tests/test_public_groups_toggle.py')
-rw-r--r--packages/meshbay-hub/tests/test_public_groups_toggle.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/packages/meshbay-hub/tests/test_public_groups_toggle.py b/packages/meshbay-hub/tests/test_public_groups_toggle.py
index 2a57429..96e3383 100644
--- a/packages/meshbay-hub/tests/test_public_groups_toggle.py
+++ b/packages/meshbay-hub/tests/test_public_groups_toggle.py
@@ -39,7 +39,7 @@ async def _user(client, username, password="a-long-enough-passphrase"):
return {"Authorization": f"Bearer {r.json()['access_token']}"}
-async def _admin(client, username="root"):
+async def _admin(client, username="root_test"):
await _user(client, username)
set_admin_usernames([username])
# re-login so the token is minted with the admin role in context
@@ -74,7 +74,7 @@ async def _set_public_groups(client, admin, allowed):
@pytest.mark.asyncio
async def test_public_groups_are_allowed_by_default(client):
- owner = await _user(client, "alice")
+ owner = await _user(client, "alice_test")
r = await client.get("/v1/hub/info")
assert r.json()["allow_public_groups"] is True
r = await client.post("/v1/groups", json=_public("open-house"), headers=owner)
@@ -83,7 +83,7 @@ async def test_public_groups_are_allowed_by_default(client):
@pytest.mark.asyncio
async def test_a_normal_member_cannot_change_the_setting(client):
- member = await _user(client, "mallory")
+ member = await _user(client, "mallory_test")
r = await client.patch("/v1/admin/settings",
json={"allow_public_groups": False}, headers=member)
assert r.status_code == 403
@@ -92,7 +92,7 @@ async def test_a_normal_member_cannot_change_the_setting(client):
@pytest.mark.asyncio
async def test_admin_disables_public_groups_end_to_end(client):
admin = await _admin(client)
- owner = await _user(client, "bob")
+ owner = await _user(client, "bob_test")
r = await client.patch("/v1/admin/settings",
json={"allow_public_groups": False}, headers=admin)
@@ -122,8 +122,8 @@ async def test_admin_disables_public_groups_end_to_end(client):
@pytest.mark.asyncio
async def test_re_enabling_restores_public_creation(client):
- admin = await _admin(client, "chief")
- owner = await _user(client, "carol")
+ admin = await _admin(client, "chief_test")
+ owner = await _user(client, "carol_test")
await client.patch("/v1/admin/settings",
json={"allow_public_groups": False}, headers=admin)
@@ -138,7 +138,7 @@ async def test_re_enabling_restores_public_creation(client):
@pytest.mark.asyncio
async def test_a_patch_without_the_field_is_a_no_op(client):
- admin = await _admin(client, "keeper")
+ admin = await _admin(client, "keeper_test")
await client.patch("/v1/admin/settings",
json={"allow_public_groups": False}, headers=admin)
r = await client.patch("/v1/admin/settings", json={}, headers=admin)
@@ -151,7 +151,7 @@ async def test_a_patch_without_the_field_is_a_no_op(client):
@pytest.mark.asyncio
async def test_disabled_empties_the_public_directory(client, db_session):
admin = await _admin(client)
- owner = await _user(client, "dora")
+ owner = await _user(client, "dora_test")
gid = await _create_public(client, owner, "town-square")
await _mark_hosted(db_session, gid)
@@ -167,8 +167,8 @@ async def test_disabled_empties_the_public_directory(client, db_session):
@pytest.mark.asyncio
async def test_disabled_refuses_open_join_of_a_public_group(client, db_session):
- admin = await _admin(client, "chief")
- owner = await _user(client, "erin")
+ admin = await _admin(client, "chief_test")
+ owner = await _user(client, "erin_test")
early = await _user(client, "early-bird")
late = await _user(client, "late-comer")
gid = await _create_public(client, owner, "commons")
@@ -188,10 +188,10 @@ async def test_disabled_refuses_open_join_of_a_public_group(client, db_session):
@pytest.mark.asyncio
async def test_disabled_hands_a_non_member_no_node(client, db_session):
- admin = await _admin(client, "chief")
- owner = await _user(client, "frank")
- member = await _user(client, "grace")
- stranger = await _user(client, "heidi")
+ admin = await _admin(client, "chief_test")
+ owner = await _user(client, "frank_test")
+ member = await _user(client, "grace_test")
+ stranger = await _user(client, "heidi_test")
gid = await _create_public(client, owner, "atrium")
await _mark_hosted(db_session, gid)
assert (await client.post(f"/v1/groups/{gid}/join", headers=member)).status_code == 200
@@ -241,7 +241,7 @@ async def test_disabled_empties_the_federation_export(client, monkeypatch):
monkeypatch.setattr(federation, "FEDERATION_ENABLED", True)
admin = await _admin(client)
- owner = await _user(client, "ivan")
+ owner = await _user(client, "ivan_test")
await _create_public(client, owner, "exported-square")
info = (await client.get("/mhp/info")).json()
@@ -262,8 +262,8 @@ async def test_disabled_empties_the_federation_export(client, monkeypatch):
@pytest.mark.asyncio
async def test_re_enabling_brings_the_directory_back(client, db_session):
- admin = await _admin(client, "chief")
- owner = await _user(client, "judy")
+ admin = await _admin(client, "chief_test")
+ owner = await _user(client, "judy_test")
gid = await _create_public(client, owner, "reopened")
await _mark_hosted(db_session, gid)