예제 #1
0
def test_subscription_policy_describe():
    """Test policy describe."""
    from invenio_groups.api import SubscriptionPolicy

    assert SubscriptionPolicy.describe(SubscriptionPolicy.OPEN)
    assert SubscriptionPolicy.describe(SubscriptionPolicy.APPROVAL)
    assert SubscriptionPolicy.describe(SubscriptionPolicy.CLOSED)
    assert SubscriptionPolicy.describe("INVALID") is None
예제 #2
0
def test_subscription_policy_validate():
    """Test policy validation."""
    from invenio_groups.api import SubscriptionPolicy

    assert SubscriptionPolicy.validate(SubscriptionPolicy.OPEN)
    assert SubscriptionPolicy.validate(SubscriptionPolicy.APPROVAL)
    assert SubscriptionPolicy.validate(SubscriptionPolicy.CLOSED)
    assert not SubscriptionPolicy.validate("INVALID")