summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_admin_views.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests/test_admin_views.py')
-rw-r--r--packages/meshbay-hub/tests/test_admin_views.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/packages/meshbay-hub/tests/test_admin_views.py b/packages/meshbay-hub/tests/test_admin_views.py
index 29f41d8..5017b76 100644
--- a/packages/meshbay-hub/tests/test_admin_views.py
+++ b/packages/meshbay-hub/tests/test_admin_views.py
@@ -31,7 +31,7 @@ async def _user(client, username, password="a-long-enough-passphrase"):
return {"Authorization": f"Bearer {r.json()['access_token']}"}
-async def _admin(client, db_session, username="root"):
+async def _admin(client, db_session, username="root_test"):
headers = await _user(client, username)
user = (await db_session.execute(
select(User).where(User.username == username))).scalar_one()
@@ -43,12 +43,12 @@ async def _admin(client, db_session, username="root"):
@pytest.mark.asyncio
async def test_a_deleted_account_stops_being_counted(client, db_session):
admin = await _admin(client, db_session)
- leaver = await _user(client, "ghost")
+ leaver = await _user(client, "ghost_test")
before = (await client.get("/v1/admin/stats", headers=admin)).json()["users"]
await client.request("DELETE", "/v1/users/me", headers=leaver,
json={"auth_key": _auth_key(
- "a-long-enough-passphrase", "ghost")})
+ "a-long-enough-passphrase", "ghost_test")})
after = (await client.get("/v1/admin/stats", headers=admin)).json()["users"]
assert after == before - 1, "a tombstone is still being counted as a user"
@@ -56,7 +56,7 @@ async def test_a_deleted_account_stops_being_counted(client, db_session):
@pytest.mark.asyncio
async def test_a_deleted_account_is_not_listed(client, db_session):
- admin = await _admin(client, db_session, "root2")
+ admin = await _admin(client, db_session, "root2_test")
leaver = await _user(client, "vanishing")
await client.request("DELETE", "/v1/users/me", headers=leaver,
@@ -73,21 +73,21 @@ async def test_a_deleted_account_is_not_listed(client, db_session):
@pytest.mark.asyncio
async def test_the_member_list_of_a_group_skips_them(client, db_session):
- admin = await _admin(client, db_session, "root3")
- owner = await _user(client, "host3")
- leaver = await _user(client, "quitter")
+ admin = await _admin(client, db_session, "root3_test")
+ owner = await _user(client, "host3_test")
+ leaver = await _user(client, "quitter_test")
g = await client.post("/v1/groups", json={"name": "party"}, headers=owner)
gid = g.json()["group_id"]
- await client.post(f"/v1/groups/{gid}/members/quitter", json={}, headers=owner)
+ await client.post(f"/v1/groups/{gid}/members/quitter_test", json={}, headers=owner)
await client.request("DELETE", "/v1/users/me", headers=leaver,
json={"auth_key": _auth_key(
- "a-long-enough-passphrase", "quitter")})
+ "a-long-enough-passphrase", "quitter_test")})
members = (await client.get(f"/v1/groups/{gid}/members",
headers=owner)).json()["members"]
- assert [m["username"] for m in members] == ["host3"]
+ assert [m["username"] for m in members] == ["host3_test"]
groups = (await client.get("/v1/admin/groups", headers=admin)).json()["groups"]
party = next(g for g in groups if g["name"] == "party")
@@ -114,7 +114,7 @@ async def test_a_node_is_recorded_at_the_address_it_announced_from(
from meshbay_hub.db.models import Node
- admin = await _admin(client, db_session, "root4")
+ admin = await _admin(client, db_session, "root4_test")
owner = await _user(client, "nodeowner")
uid = (await db_session.execute(
select(User.id).where(User.username == "nodeowner"))).scalar_one()