Ejemplo n.º 1
0
    def test_correct_class(self):
        class A(object):
            pass

        predicate = events.ModelClassIs(model=A, config=None)
        event = events.BeforeIndex(view=None, model=A)
        assert predicate(event)
Ejemplo n.º 2
0
 def test_field_not_changed(self):
     predicate = events.FieldIsChanged(field='username', config=None)
     event = events.BeforeIndex(view=None,
                                model=None,
                                fields={'password': '******'})
     assert event.field is None
     assert not predicate(event)
     assert event.field is None