Beispiel #1
0
    def test_method_failed_validation_pass(self):
        fields = {'myField': 'itsa me, mario !'}
        rules = {'myField': 'required'}

        v = Validator(fields = fields, rules = rules)

        self.assertFalse(v.failed())
Beispiel #2
0
    def test_method_failed_validation_fail(self):
        fields = {'myField': ''}
        rules = {'myField': 'required|email'}

        v = Validator(fields = fields, rules = rules)

        ### v.failed contains a list of failed validations, and their respective fields
        ### should print : [{u'myField': u'required'}, {u'myField': u'email'}]
        self.assertTrue(v.failed())