diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-15 02:16:39 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-15 02:21:01 +0200 |
| commit | bdefcd025604f2c3009fe5e0cc01213c2ba62a6a (patch) | |
| tree | eebd34aa234a9148045ca25b00bf7c8039e00ccf /packages/meshbay-hub/tests/test_admin_views.py | |
| parent | 027e7d55f3bb57ba5150fd77e8f0114a0baf8d5c (diff) | |
| download | meshbay-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_admin_views.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_admin_views.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/packages/meshbay-hub/tests/test_admin_views.py b/packages/meshbay-hub/tests/test_admin_views.py index 29f41d8..5017b76 100644 --- a/packages/meshbay-hub/tests/test_admin_views.py +++ b/packages/meshbay-hub/tests/test_admin_views.py @@ -31,7 +31,7 @@ async def _user(client, username, password="a-long-enough-passphrase"): return {"Authorization": f"Bearer {r.json()['access_token']}"} -async def _admin(client, db_session, username="root"): +async def _admin(client, db_session, username="root_test"): headers = await _user(client, username) user = (await db_session.execute( select(User).where(User.username == username))).scalar_one() @@ -43,12 +43,12 @@ async def _admin(client, db_session, username="root"): @pytest.mark.asyncio async def test_a_deleted_account_stops_being_counted(client, db_session): admin = await _admin(client, db_session) - leaver = await _user(client, "ghost") + leaver = await _user(client, "ghost_test") before = (await client.get("/v1/admin/stats", headers=admin)).json()["users"] await client.request("DELETE", "/v1/users/me", headers=leaver, json={"auth_key": _auth_key( - "a-long-enough-passphrase", "ghost")}) + "a-long-enough-passphrase", "ghost_test")}) after = (await client.get("/v1/admin/stats", headers=admin)).json()["users"] assert after == before - 1, "a tombstone is still being counted as a user" @@ -56,7 +56,7 @@ async def test_a_deleted_account_stops_being_counted(client, db_session): @pytest.mark.asyncio async def test_a_deleted_account_is_not_listed(client, db_session): - admin = await _admin(client, db_session, "root2") + admin = await _admin(client, db_session, "root2_test") leaver = await _user(client, "vanishing") await client.request("DELETE", "/v1/users/me", headers=leaver, @@ -73,21 +73,21 @@ async def test_a_deleted_account_is_not_listed(client, db_session): @pytest.mark.asyncio async def test_the_member_list_of_a_group_skips_them(client, db_session): - admin = await _admin(client, db_session, "root3") - owner = await _user(client, "host3") - leaver = await _user(client, "quitter") + admin = await _admin(client, db_session, "root3_test") + owner = await _user(client, "host3_test") + leaver = await _user(client, "quitter_test") g = await client.post("/v1/groups", json={"name": "party"}, headers=owner) gid = g.json()["group_id"] - await client.post(f"/v1/groups/{gid}/members/quitter", json={}, headers=owner) + await client.post(f"/v1/groups/{gid}/members/quitter_test", json={}, headers=owner) await client.request("DELETE", "/v1/users/me", headers=leaver, json={"auth_key": _auth_key( - "a-long-enough-passphrase", "quitter")}) + "a-long-enough-passphrase", "quitter_test")}) members = (await client.get(f"/v1/groups/{gid}/members", headers=owner)).json()["members"] - assert [m["username"] for m in members] == ["host3"] + assert [m["username"] for m in members] == ["host3_test"] groups = (await client.get("/v1/admin/groups", headers=admin)).json()["groups"] party = next(g for g in groups if g["name"] == "party") @@ -114,7 +114,7 @@ async def test_a_node_is_recorded_at_the_address_it_announced_from( from meshbay_hub.db.models import Node - admin = await _admin(client, db_session, "root4") + admin = await _admin(client, db_session, "root4_test") owner = await _user(client, "nodeowner") uid = (await db_session.execute( select(User.id).where(User.username == "nodeowner"))).scalar_one() |