aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_node_auth.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests/test_node_auth.py')
-rw-r--r--packages/meshbay-hub/tests/test_node_auth.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/packages/meshbay-hub/tests/test_node_auth.py b/packages/meshbay-hub/tests/test_node_auth.py
index a104a72..4137932 100644
--- a/packages/meshbay-hub/tests/test_node_auth.py
+++ b/packages/meshbay-hub/tests/test_node_auth.py
@@ -153,7 +153,7 @@ async def test_node_token_may_add_a_member_to_its_own_operators_group(client):
the invitee's SPA (commit 0443cf8). A node-scoped token is accepted here —
the `group.admin_id == caller` check is the guard — but only for a group the
node's operator owns."""
- sk_op, op_token = await _setup_node_user(client, "op1")
+ sk_op, op_token = await _setup_node_user(client, "op1_test")
r = await client.post("/v1/groups", json={
"name": "mygroup", "visibility": "private", "join_policy": "invite",
@@ -162,34 +162,34 @@ async def test_node_token_may_add_a_member_to_its_own_operators_group(client):
_, pk2 = _gen_ed25519()
_, px2 = _gen_x25519()
- await _register(client, "member1", pk2, px2)
+ await _register(client, "member1_test", pk2, px2)
- node_token = (await _node_auth(client, "op1", sk_op)).json()["access_token"]
+ node_token = (await _node_auth(client, "op1_test", sk_op)).json()["access_token"]
- r = await client.post(f"/v1/groups/{gid}/members/member1",
+ r = await client.post(f"/v1/groups/{gid}/members/member1_test",
headers={"Authorization": f"Bearer {node_token}"})
assert r.status_code == 201
# …but not to a group it does not own.
- sk_other, other_token = await _setup_node_user(client, "op2")
+ sk_other, other_token = await _setup_node_user(client, "op2_test")
r = await client.post("/v1/groups", json={"name": "theirs", "visibility": "private"},
headers={"Authorization": f"Bearer {other_token}"})
other_gid = r.json()["group_id"]
- r = await client.post(f"/v1/groups/{other_gid}/members/member1",
+ r = await client.post(f"/v1/groups/{other_gid}/members/member1_test",
headers={"Authorization": f"Bearer {node_token}"})
assert r.status_code == 403
@pytest.mark.asyncio
async def test_node_scope_blocks_delete_group(client):
- sk_node, user_token = await _setup_node_user(client, "op2")
+ sk_node, user_token = await _setup_node_user(client, "op2_test")
r = await client.post("/v1/groups", json={
"name": "deleteme", "visibility": "public", "join_policy": "open",
}, headers={"Authorization": f"Bearer {user_token}"})
gid = r.json()["group_id"]
- r = await _node_auth(client, "op2", sk_node)
+ r = await _node_auth(client, "op2_test", sk_node)
node_token = r.json()["access_token"]
r = await client.delete(f"/v1/groups/{gid}",
@@ -199,14 +199,14 @@ async def test_node_scope_blocks_delete_group(client):
@pytest.mark.asyncio
async def test_node_scope_allows_read_members(client):
- sk_node, user_token = await _setup_node_user(client, "op3")
+ sk_node, user_token = await _setup_node_user(client, "op3_test")
r = await client.post("/v1/groups", json={
"name": "readgroup", "visibility": "private", "join_policy": "invite",
}, headers={"Authorization": f"Bearer {user_token}"})
gid = r.json()["group_id"]
- r = await _node_auth(client, "op3", sk_node)
+ r = await _node_auth(client, "op3_test", sk_node)
node_token = r.json()["access_token"]
r = await client.get(f"/v1/groups/{gid}/members",
@@ -217,12 +217,12 @@ async def test_node_scope_allows_read_members(client):
@pytest.mark.asyncio
async def test_node_scope_allows_pubkey_lookup(client):
- sk_node, _ = await _setup_node_user(client, "op4")
+ sk_node, _ = await _setup_node_user(client, "op4_test")
- r = await _node_auth(client, "op4", sk_node)
+ r = await _node_auth(client, "op4_test", sk_node)
node_token = r.json()["access_token"]
- r = await client.get("/v1/users/op4/pubkeys",
+ r = await client.get("/v1/users/op4_test/pubkeys",
headers={"Authorization": f"Bearer {node_token}"})
assert r.status_code == 200
# An account id and the node's linking key — no user identity keys (H3).
@@ -235,9 +235,9 @@ async def test_user_scope_still_works(client):
"""Verify that user-scoped tokens (browser login) still have full access."""
_, pk_ed = _gen_ed25519()
_, pk_x = _gen_x25519()
- await _register(client, "webuser", pk_ed, pk_x)
+ await _register(client, "webuser_test", pk_ed, pk_x)
- token = await _user_login(client, "webuser")
+ token = await _user_login(client, "webuser_test")
r = await client.post("/v1/groups", json={
"name": "browser-group", "visibility": "public", "join_policy": "open",
@@ -268,9 +268,9 @@ async def test_link_node_key(client):
async def test_link_node_key_invalid_format(client):
_, pk_ed = _gen_ed25519()
_, pk_x = _gen_x25519()
- await _register(client, "badkey", pk_ed, pk_x)
+ await _register(client, "badkey_test", pk_ed, pk_x)
- token = await _user_login(client, "badkey")
+ token = await _user_login(client, "badkey_test")
r = await client.put("/v1/users/me/node_key", json={
"pk_node_ed25519": "not-valid-base64!!!",
@@ -281,9 +281,9 @@ async def test_link_node_key_invalid_format(client):
@pytest.mark.asyncio
async def test_link_node_key_blocked_for_node_scope(client):
"""Node-scoped tokens must not be able to change the node key."""
- sk_node, _ = await _setup_node_user(client, "sneaky")
+ sk_node, _ = await _setup_node_user(client, "sneaky_test")
- r = await _node_auth(client, "sneaky", sk_node)
+ r = await _node_auth(client, "sneaky_test", sk_node)
node_token = r.json()["access_token"]
_, pk_evil = _gen_ed25519()