diff options
Diffstat (limited to 'packages/meshbay-hub/tests/test_hub_api.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_hub_api.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/meshbay-hub/tests/test_hub_api.py b/packages/meshbay-hub/tests/test_hub_api.py index 5a2cf86..5314b93 100644 --- a/packages/meshbay-hub/tests/test_hub_api.py +++ b/packages/meshbay-hub/tests/test_hub_api.py @@ -365,7 +365,7 @@ async def test_jwt_contains_groups_claim(client): # ── My groups (9.6) ───────────────────────────────────────────────────────── @pytest.mark.asyncio -async def test_my_groups(client): +async def test_my_groups(client, db_session): """GET /v1/groups/mine returns groups the user belongs to.""" pk_ed_a, pk_x_a, _ = _gen_user_keys() pk_ed_b, pk_x_b, _ = _gen_user_keys() @@ -396,6 +396,14 @@ async def test_my_groups(client): json={}, headers={"Authorization": f"Bearer {alice_token}"}) + # A group no node has announced is shown to its owner only — a member would + # otherwise see a name they cannot open. Stamped here so the rest of this + # test is about membership, which is what it was written for. + from datetime import datetime, timezone + from meshbay_hub.db.models import Group + (await db_session.get(Group, group_id)).hosted_at = datetime.now(timezone.utc) + await db_session.commit() + # Re-login to get fresh token with group claims bob_token = (await client.post("/v1/users/login", json={"username": "mg_bob", "password": "bobpass99"})).json()["access_token"] |