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_notifications_behaviour.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_notifications_behaviour.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_notifications_behaviour.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/packages/meshbay-hub/tests/test_notifications_behaviour.py b/packages/meshbay-hub/tests/test_notifications_behaviour.py index 5fe9170..a247508 100644 --- a/packages/meshbay-hub/tests/test_notifications_behaviour.py +++ b/packages/meshbay-hub/tests/test_notifications_behaviour.py @@ -37,7 +37,7 @@ async def test_chat_keeps_one_notification_per_group(client, db_session): from meshbay_hub.api.notifications import create_notification token = await _user(client, "listener") - owner = await _user(client, "talker") + owner = await _user(client, "talker_test") g = await client.post("/v1/groups", json={"name": "busy"}, headers={"Authorization": f"Bearer {owner}"}) gid = g.json()["group_id"] @@ -68,12 +68,12 @@ async def test_muting_a_group_stops_notifications_being_created(client, db_sessi """ from meshbay_hub.api.notifications import create_notification - token = await _user(client, "quiet") - owner = await _user(client, "noisy") + token = await _user(client, "quiet_test") + owner = await _user(client, "noisy_test") g = await client.post("/v1/groups", json={"name": "loud"}, headers={"Authorization": f"Bearer {owner}"}) gid = g.json()["group_id"] - await client.post(f"/v1/groups/{gid}/members/quiet", json={}, + await client.post(f"/v1/groups/{gid}/members/quiet_test", json={}, headers={"Authorization": f"Bearer {owner}"}) r = await client.post(f"/v1/groups/{gid}/mute", json={"muted": True}, @@ -81,7 +81,7 @@ async def test_muting_a_group_stops_notifications_being_created(client, db_sessi assert r.status_code == 200, r.text uid = (await db_session.execute( - select(User.id).where(User.username == "quiet"))).scalar_one() + select(User.id).where(User.username == "quiet_test"))).scalar_one() await db_session.execute( select(GroupMember).where(GroupMember.user_id == uid)) @@ -138,10 +138,10 @@ async def test_purge_clears_the_list(client, db_session): async def test_only_your_own_notifications_are_purged(client, db_session): from meshbay_hub.api.notifications import create_notification - mine = await _user(client, "self") - await _user(client, "other") + mine = await _user(client, "self_test") + await _user(client, "other_test") other_id = (await db_session.execute( - select(User.id).where(User.username == "other"))).scalar_one() + select(User.id).where(User.username == "other_test"))).scalar_one() await create_notification(db_session, other_id, "system", "not yours") await db_session.commit() @@ -165,17 +165,17 @@ async def test_you_are_not_notified_of_your_own_message(client, db_session): from meshbay_hub.api.revocation import _handle_chat_notify owner = await _user(client, "operator") - await _user(client, "chatty") - await _user(client, "quiet") + await _user(client, "chatty_test") + await _user(client, "quiet_test") g = await client.post("/v1/groups", json={"name": "room"}, headers={"Authorization": f"Bearer {owner}"}) gid = g.json()["group_id"] - for name in ("chatty", "quiet"): + for name in ("chatty_test", "quiet_test"): await client.post(f"/v1/groups/{gid}/members/{name}", json={}, headers={"Authorization": f"Bearer {owner}"}) ids = {u.username: u.id for u in (await db_session.execute( - select(User).where(User.username.in_(["operator", "chatty", "quiet"])) + select(User).where(User.username.in_(["operator", "chatty_test", "quiet_test"])) )).scalars().all()} # A node registered for this group, because a notification is now written @@ -183,7 +183,7 @@ async def test_you_are_not_notified_of_your_own_message(client, db_session): node_id = "notify-test-node" rev._node_groups[node_id] = [gid] try: - await _handle_chat_notify(gid, "chatty", ids["chatty"], node_id=node_id) + await _handle_chat_notify(gid, "chatty_test", ids["chatty_test"], node_id=node_id) finally: rev._node_groups.pop(node_id, None) @@ -193,7 +193,7 @@ async def test_you_are_not_notified_of_your_own_message(client, db_session): Notification.kind == "chat_message") )).scalars().all() - assert await chat_rows(ids["chatty"]) == [], "notified of their own message" - assert len(await chat_rows(ids["quiet"])) == 1 + assert await chat_rows(ids["chatty_test"]) == [], "notified of their own message" + assert len(await chat_rows(ids["quiet_test"])) == 1 assert len(await chat_rows(ids["operator"])) == 1, \ "the operator reads the group too, and was the one being skipped" |