Example #1
0
    def test_validate(self):
        """Test policy validation."""
        from invenio_groups.models import SubscriptionPolicy

        self.assertTrue(SubscriptionPolicy.validate(SubscriptionPolicy.OPEN))
        self.assertTrue(SubscriptionPolicy.validate(
            SubscriptionPolicy.APPROVAL))
        self.assertTrue(SubscriptionPolicy.validate(SubscriptionPolicy.CLOSED))
        self.assertFalse(SubscriptionPolicy.validate("INVALID"))
Example #2
0
    def test_describe(self):
        """Test policy describe."""
        from invenio_groups.models import SubscriptionPolicy

        self.assertTrue(
            SubscriptionPolicy.describe(SubscriptionPolicy.OPEN))
        self.assertTrue(
            SubscriptionPolicy.describe(SubscriptionPolicy.APPROVAL))
        self.assertTrue(
            SubscriptionPolicy.describe(SubscriptionPolicy.CLOSED))
        self.assertIsNone(SubscriptionPolicy.describe("INVALID"))