Guest cap $5 -> $2: GUEST_BUDGET default, emails, docs, tests

This commit is contained in:
inference-bot committed 2026-11-08 20:12:47 +00:00
1 parent 0f12c63f5e
commit 6be8e2d632
6 files changed
+45 -45

No files matched your search

+7 -7
View File
@@ -2,7 +2,7 @@
"""Guest-account lifecycle tests — structurally isolated from live services.
WHY THIS EXISTS
Guest accounts (operator feature, 2026-11-08) touch money ($5 of credits),
Guest accounts (operator feature, 2026-11-08) touch money ($2 of credits),
Cloudron groups and email. Every path proven here runs against a FIXTURE
database with the network layer REPLACED BY A RAISING GUARD: any code path
that tries to reach Cloudron, LiteLLM, OC, Listmonk, Loomio, Matrix or SMTP
@@ -237,12 +237,12 @@ def main():
conn = m.get_db()
check("provision: row marked guest", row_of(conn, "invited@x.org", "account_type") == "guest")
check("provision: allowance balance 0", row_of(conn, "invited@x.org", "balance") == 0.0)
check("provision: $5 credit", row_of(conn, "invited@x.org", "credit_balance") == 5.0)
check("provision: $2 credit", row_of(conn, "invited@x.org", "credit_balance") == 2.0)
check("provision: guest_expires_at set", bool(row_of(conn, "invited@x.org", "guest_expires_at")))
check("provision: group = guests group",
calls["group"] and calls["group"][0][1] == m.GUESTS_GROUP_ID, str(calls["group"]))
check("provision: cap set to 5.00 (one-time)",
(calls["budget"] and calls["budget"][0][1] == 5.0), str(calls["budget"]))
check("provision: cap set to 2.00 (one-time)",
(calls["budget"] and calls["budget"][0][1] == 2.0), str(calls["budget"]))
check("provision: invitation email sent (merged invite + welcome)",
any("invited to the Inference Cooperative" in s for _, s in calls["email"]), str(calls["email"]))
check("provision: newsletter subscribed",
@@ -264,11 +264,11 @@ def main():
check("convert: allowance lifted to MEMBER_BUDGET",
row_of(conn, "invited@x.org", "balance") == m.MEMBER_BUDGET)
check("convert: unspent guest credit carried",
row_of(conn, "invited@x.org", "credit_balance") == 5.0)
row_of(conn, "invited@x.org", "credit_balance") == 2.0)
check("convert: group moved to members",
calls["group"] and calls["group"][0][1] == m.MEMBERS_GROUP_ID, str(calls["group"]))
check("convert: cap lifted to 20.00 (15 + 5 credits)",
(calls["budget"] and calls["budget"][0][1] == m.MEMBER_BUDGET + 5.0), str(calls["budget"]))
check("convert: cap lifted to 17.00 (15 + 2 credits)",
(calls["budget"] and calls["budget"][0][1] == m.MEMBER_BUDGET + 2.0), str(calls["budget"]))
check("convert: anchor day kept", row_of(conn, "invited@x.org", "anchor_day") == anchor_before)
check("convert: congrats email sent",
any("member now" in s for _, s in calls["email"]), str(calls["email"]))