aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests')
-rw-r--r--packages/meshbay-hub/tests/test_mnp_token.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_mnp_token.py b/packages/meshbay-hub/tests/test_mnp_token.py
index ef6423d..71d7ff6 100644
--- a/packages/meshbay-hub/tests/test_mnp_token.py
+++ b/packages/meshbay-hub/tests/test_mnp_token.py
@@ -136,3 +136,17 @@ async def test_a_token_must_name_its_group(client):
r = await client.post("/v1/nodes/mnp-token", json={},
headers={"Authorization": f"Bearer {tok}"})
assert r.status_code == 422
+
+
+@pytest.mark.asyncio
+async def test_mnp_token_names_the_account(client):
+ """A member admitted by link has no name in the node's roster but this one;
+ without it the node's audit log shows a bare id."""
+ from meshbay_hub.auth import hub_public_key_pem
+
+ tok = await _session_token(client, "mnp_named")
+ gid = await _own_group(client, tok)
+ mnp = (await client.post("/v1/nodes/mnp-token", json={"group_id": gid},
+ headers={"Authorization": f"Bearer {tok}"})).json()["mnp_token"]
+ peer = authorize_token(mnp, hub_public_key_pem(), group_id=gid)
+ assert peer.username == "mnp_named"