web: economy reads real ledger field names (from_id/to_id); fixtures match live shape
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
63b39ed39b
commit
543d07b6a1
2 changed files with 7 additions and 7 deletions
|
|
@ -21,8 +21,8 @@ def _headers() -> dict[str, str]:
|
|||
def _tx_dto(tx: dict[str, Any]) -> dict[str, Any]:
|
||||
return {
|
||||
"ts": tx.get("ts"),
|
||||
"from": tx.get("from"),
|
||||
"to": tx.get("to"),
|
||||
"from": tx.get("from_id", tx.get("from")),
|
||||
"to": tx.get("to_id", tx.get("to")),
|
||||
"amount": tx.get("amount"),
|
||||
"reason": tx.get("reason"),
|
||||
"ref": tx.get("ref"),
|
||||
|
|
@ -91,7 +91,7 @@ async def economy() -> dict[str, Any] | JSONResponse:
|
|||
{
|
||||
party
|
||||
for tx in transactions
|
||||
for party in (tx.get("from"), tx.get("to"))
|
||||
for party in (tx.get("from_id", tx.get("from")), tx.get("to_id", tx.get("to")))
|
||||
if party and party != "mint"
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ def _ok_transport(request: httpx.Request) -> httpx.Response:
|
|||
"transactions": [
|
||||
{
|
||||
"ts": "2026-07-02T09:00:00Z",
|
||||
"from": "mint",
|
||||
"from_id": "mint",
|
||||
"to": "m2bd",
|
||||
"amount": 50,
|
||||
"reason": "grant",
|
||||
|
|
@ -116,8 +116,8 @@ def _ok_transport(request: httpx.Request) -> httpx.Response:
|
|||
200,
|
||||
json={
|
||||
"transactions": [
|
||||
{"from": "mint", "to": "m2bd", "amount": 50},
|
||||
{"from": "m2bd", "to": "platform", "amount": 8},
|
||||
{"from_id": "mint", "to_id": "m2bd", "amount": 50},
|
||||
{"from_id": "m2bd", "to_id": "platform", "amount": 8},
|
||||
]
|
||||
},
|
||||
)
|
||||
|
|
@ -187,7 +187,7 @@ def test_catalog_wallet_economy_governance_happy_paths(
|
|||
assert wallet.json()["balance"] == 42
|
||||
assert wallet.json()["transactions"][0] == {
|
||||
"ts": "2026-07-02T09:00:00Z",
|
||||
"from": "mint",
|
||||
"from_id": "mint",
|
||||
"to": "m2bd",
|
||||
"amount": 50,
|
||||
"reason": "grant",
|
||||
|
|
|
|||
Loading…
Reference in a new issue