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"))
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"))