The demo account — one shared user that whitelisted emails entered from the login page, reset on a schedule — goes end to end (owner decision, E34): demo.py and the reset job, users.is_demo and demo_whitelist (migration 0098 deletes the demo user, its audit rows, the reset job's override and notices, then drops the column and table; the downgrade restores the empty schema), the /auth/demo entry, the admin whitelist and reset, the Demo tab, the banner, the login page's "Try the demo", and every is_demo branch in routes, userscope, scheduler and the UI. require_human only ever refused the demo account, so its 87 uses become current_user (owner-approved); require_write_scope keeps its own check. The login page's "or" divider now shows only beside the Google button: without the demo entry under it, an instance without Google would have said "or" to nothing. A contract test (removedFeatures) fails on the word anywhere in the backend, frontend, e2e or scripts — seen red on a planted hit. Size ceilings tightened for the modules that shrank; admin.py is back under the limit.
24 lines
727 B
Python
24 lines
727 B
Python
"""is_messageable_user — the "active, non-suspended account" predicate reused by the download share
|
|
endpoints. A row must be active AND not-suspended."""
|
|
|
|
from types import SimpleNamespace
|
|
|
|
from app.userscope import is_messageable_user
|
|
|
|
|
|
def _user(is_active=True, is_suspended=False):
|
|
return SimpleNamespace(is_active=is_active, is_suspended=is_suspended)
|
|
|
|
|
|
def test_an_active_account_is_messageable():
|
|
assert is_messageable_user(_user()) is True
|
|
|
|
|
|
def test_none_is_not_messageable():
|
|
assert is_messageable_user(None) is False
|
|
|
|
|
|
def test_suspended_or_inactive_are_not_messageable():
|
|
assert is_messageable_user(_user(is_suspended=True)) is False
|
|
assert is_messageable_user(_user(is_active=False)) is False
|