diff options
Diffstat (limited to 'packages/meshbay-hub/tests/test_groups_self_service.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_groups_self_service.py | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/packages/meshbay-hub/tests/test_groups_self_service.py b/packages/meshbay-hub/tests/test_groups_self_service.py index def663d..f9346c1 100644 --- a/packages/meshbay-hub/tests/test_groups_self_service.py +++ b/packages/meshbay-hub/tests/test_groups_self_service.py @@ -52,8 +52,8 @@ async def _mark_hosted(db_session, *group_ids): @pytest.mark.asyncio async def test_create_group(client): - await _register(client, "alice", email="a@x.com") - token = await _login(client, "alice") + await _register(client, "alice_test", email="a@x.com") + token = await _login(client, "alice_test") r = await client.post("/v1/groups", json={ "name": "my-group", "visibility": "public", "join_policy": "open", @@ -66,12 +66,12 @@ async def test_create_group(client): @pytest.mark.asyncio async def test_join_open_group(client): - await _register(client, "alice", email="a@x.com") - alice_token = await _login(client, "alice") + await _register(client, "alice_test", email="a@x.com") + alice_token = await _login(client, "alice_test") gid = await _create_group(client, alice_token, "open-group") - await _register(client, "bob", email="b@x.com") - bob_token = await _login(client, "bob") + await _register(client, "bob_test", email="b@x.com") + bob_token = await _login(client, "bob_test") r = await client.post(f"/v1/groups/{gid}/join", headers={"Authorization": f"Bearer {bob_token}"}) @@ -81,16 +81,16 @@ async def test_join_open_group(client): @pytest.mark.asyncio async def test_join_invite_group_rejected(client): - await _register(client, "alice", email="a@x.com") - alice_token = await _login(client, "alice") + await _register(client, "alice_test", email="a@x.com") + alice_token = await _login(client, "alice_test") # Private: invite-only is refused on a public group now, since a group # everyone can find and nobody can enter is a dead end. What is under test # here — /join refusing a group that is not open — is unchanged. gid = await _create_group(client, alice_token, "invite-group", visibility="private", join_policy="invite") - await _register(client, "bob", email="b@x.com") - bob_token = await _login(client, "bob") + await _register(client, "bob_test", email="b@x.com") + bob_token = await _login(client, "bob_test") r = await client.post(f"/v1/groups/{gid}/join", headers={"Authorization": f"Bearer {bob_token}"}) @@ -99,8 +99,8 @@ async def test_join_invite_group_rejected(client): @pytest.mark.asyncio async def test_join_already_member(client): - await _register(client, "alice", email="a@x.com") - alice_token = await _login(client, "alice") + await _register(client, "alice_test", email="a@x.com") + alice_token = await _login(client, "alice_test") gid = await _create_group(client, alice_token, "dup-group") r = await client.post(f"/v1/groups/{gid}/join", @@ -110,12 +110,12 @@ async def test_join_already_member(client): @pytest.mark.asyncio async def test_group_members(client): - await _register(client, "alice", email="a@x.com") - alice_token = await _login(client, "alice") + await _register(client, "alice_test", email="a@x.com") + alice_token = await _login(client, "alice_test") gid = await _create_group(client, alice_token, "team-group") - await _register(client, "bob", email="b@x.com") - bob_token = await _login(client, "bob") + await _register(client, "bob_test", email="b@x.com") + bob_token = await _login(client, "bob_test") await client.post(f"/v1/groups/{gid}/join", headers={"Authorization": f"Bearer {bob_token}"}) @@ -124,20 +124,20 @@ async def test_group_members(client): assert r.status_code == 200 data = r.json() usernames = [m["username"] for m in data["members"]] - assert "alice" in usernames - assert "bob" in usernames + assert "alice_test" in usernames + assert "bob_test" in usernames assert data["admin_id"] is not None @pytest.mark.asyncio async def test_group_members_non_member_denied(client): - await _register(client, "alice", email="a@x.com") - alice_token = await _login(client, "alice") + await _register(client, "alice_test", email="a@x.com") + alice_token = await _login(client, "alice_test") gid = await _create_group(client, alice_token, "private-group", visibility="private", join_policy="invite") - await _register(client, "bob", email="b@x.com") - bob_token = await _login(client, "bob") + await _register(client, "bob_test", email="b@x.com") + bob_token = await _login(client, "bob_test") r = await client.get(f"/v1/groups/{gid}/members", headers={"Authorization": f"Bearer {bob_token}"}) @@ -146,8 +146,8 @@ async def test_group_members_non_member_denied(client): @pytest.mark.asyncio async def test_group_search(client, db_session): - await _register(client, "alice", email="a@x.com") - token = await _login(client, "alice") + await _register(client, "alice_test", email="a@x.com") + token = await _login(client, "alice_test") a = await _create_group(client, token, "alpha-team") b = await _create_group(client, token, "beta-team") # The directory shows groups a node has announced. Marked here so this test @@ -163,12 +163,12 @@ async def test_group_search(client, db_session): @pytest.mark.asyncio async def test_join_triggers_notification(client): - await _register(client, "alice", email="a@x.com") - alice_token = await _login(client, "alice") + await _register(client, "alice_test", email="a@x.com") + alice_token = await _login(client, "alice_test") gid = await _create_group(client, alice_token, "notif-group") - await _register(client, "bob", email="b@x.com") - bob_token = await _login(client, "bob") + await _register(client, "bob_test", email="b@x.com") + bob_token = await _login(client, "bob_test") await client.post(f"/v1/groups/{gid}/join", headers={"Authorization": f"Bearer {bob_token}"}) @@ -187,8 +187,8 @@ async def test_a_private_group_cannot_be_open_to_everyone(client): rather than a link, so nothing can reach it. It was accepted until now, and the create form offered it. """ - await _register(client, "pat", email="pat@x.com") - token = await _login(client, "pat") + await _register(client, "pat_test", email="pat@x.com") + token = await _login(client, "pat_test") resp = await client.post("/v1/groups", json={ "name": "nowhere", "visibility": "private", "join_policy": "open", }, headers={"Authorization": f"Bearer {token}"}) @@ -201,8 +201,8 @@ async def test_a_private_group_cannot_be_open_to_everyone(client): async def test_a_public_group_cannot_be_invite_only(client): """The other half, which was already refused — kept so that removing one check does not quietly remove both.""" - await _register(client, "sam", email="sam@x.com") - token = await _login(client, "sam") + await _register(client, "sam_test", email="sam@x.com") + token = await _login(client, "sam_test") resp = await client.post("/v1/groups", json={ "name": "deadend", "visibility": "public", "join_policy": "invite", }, headers={"Authorization": f"Bearer {token}"}) @@ -212,8 +212,8 @@ async def test_a_public_group_cannot_be_invite_only(client): @pytest.mark.asyncio async def test_the_two_combinations_that_mean_something_are_accepted(client): - await _register(client, "robin", email="robin@x.com") - token = await _login(client, "robin") + await _register(client, "robin_test", email="robin@x.com") + token = await _login(client, "robin_test") for name, visibility, policy in (("closed", "private", "invite"), ("open-house", "public", "open")): resp = await client.post("/v1/groups", json={ |