gabriel / musehub public
test_org_profile_roster.py python
52 lines 2.0 KB
Raw
sha256:f19d5e4a89766fc91b926cdf801255e12dcd968041c0ece8adf6627760788d22 merge: next build — MCP (#291 #292 #295 #324), profiles/sit… Opus 5.5 minor ⚠ breaking 1 day ago
1 """The org profile's Member Roster shows only stored data (musehub#303).
2
3 The roster used to print a Type column of ``member`` and a Voting weight column of ``1`` for every
4 member, constants in the template: the data model stores member handles, a quorum and a treasury
5 address, and no per-member role or weight.
6 """
7
8 from __future__ import annotations
9
10 import re
11
12 from httpx import AsyncClient
13 from sqlalchemy.ext.asyncio import AsyncSession
14
15 from musehub.core.genesis import compute_identity_id
16 from musehub.db.musehub_identity_models import MusehubIdentity
17
18 _TREASURY = "0xcd3B766CCDd6AE721141F452C550Ca635964ce71"
19
20
21 async def _org(db: AsyncSession, *, treasury: str | None) -> None:
22 db.add(MusehubIdentity(
23 identity_id=compute_identity_id(b"roster-org"), handle="roster-org", identity_type="org",
24 display_name="Roster Org", org_members=["roster-h", "roster-a"], org_quorum=2,
25 org_treasury_address=treasury,
26 ))
27 await db.commit()
28
29
30 def _roster(html: str) -> str:
31 return html.split("<h2>Member Roster</h2>", 1)[1].split("</section>", 1)[0]
32
33
34 async def test_roster_lists_members_quorum_and_treasury_without_invented_columns(
35 client: AsyncClient, db_session: AsyncSession
36 ) -> None:
37 await _org(db_session, treasury=_TREASURY)
38 response = await client.get("/roster-org")
39 assert response.status_code == 200
40 roster = _roster(response.text)
41 assert re.findall(r'href="/(roster-[ha])"', roster) == ["roster-h", "roster-a"]
42 assert "2 members · quorum 2" in roster
43 assert _TREASURY in roster
44 assert "roster-role" not in roster and "roster-weight" not in roster
45 assert "Voting weight" not in roster and "<th>Type</th>" not in roster
46
47
48 async def test_roster_without_a_treasury_address(client: AsyncClient, db_session: AsyncSession) -> None:
49 await _org(db_session, treasury=None)
50 response = await client.get("/roster-org")
51 assert response.status_code == 200
52 assert "treasury" not in _roster(response.text).lower()
File History 3 commits
sha256:f19d5e4a89766fc91b926cdf801255e12dcd968041c0ece8adf6627760788d22 merge: next build — MCP (#291 #292 #295 #324), profiles/sit… Opus 5.5 minor ⚠ 1 day ago
sha256:7a1f4dfd571e937cb1032574d5c0965ba04ad520adcf523dec123d7a34746236 merge: rc26 — profiles/site wave (#119 #301 #303 #307 #314;… Opus 5.5 minor ⚠ 1 day ago
sha256:d5a444bc3d2142a9e90f5dd56f4f51fdfccdd0e4c87d3b90702914c5d99470a3 fix(profiles): MPay totals cover every claim; org roster sh… Opus 5.5 minor ⚠ 2 days ago