"""is_messageable_user — the "real, active, non-suspended human" predicate reused by the messaging
directory and the download share endpoints. A row must be non-demo AND active AND not-suspended."""
from types import SimpleNamespace

from app.userscope import is_messageable_user


def _user(is_demo=False, is_active=True, is_suspended=False):
    return SimpleNamespace(is_demo=is_demo, is_active=is_active, is_suspended=is_suspended)


def test_a_real_active_human_is_messageable():
    assert is_messageable_user(_user()) is True


def test_none_is_not_messageable():
    assert is_messageable_user(None) is False


def test_demo_suspended_or_inactive_are_not_messageable():
    assert is_messageable_user(_user(is_demo=True)) is False
    assert is_messageable_user(_user(is_suspended=True)) is False
    assert is_messageable_user(_user(is_active=False)) is False
