Ejemplo n.º 1
0
 def test_is_authenticated_rule(self):
     self.assertFalse(rules_light.is_authenticated(None, 'foo'))
     self.assertTrue(rules_light.is_authenticated(self.user, 'foo'))
Ejemplo n.º 2
0
    def test_is_authenticated_decorator(self):
        return_true = rules_light.is_authenticated(lambda u, r: True)

        self.assertFalse(return_true(None, 'foo'))
        self.assertTrue(return_true(self.user, 'foo'))
 def test_is_authenticated_rule(self):
     self.assertFalse(rules_light.is_authenticated(None, 'foo'))
     self.assertTrue(rules_light.is_authenticated(self.user, 'foo'))
import rules_light


rules_light.registry.setdefault('form_designer.form.create', True)
rules_light.registry.setdefault('form_designer.form.update',
    rules_light.is_authenticated(
        lambda user, rule, form: user == form.author))
    def test_is_authenticated_decorator(self):
        return_true = rules_light.is_authenticated(lambda u, r: True)

        self.assertFalse(return_true(None, 'foo'))
        self.assertTrue(return_true(self.user, 'foo'))