def test_verify_rules_fields_fail(self): v = Validator() v.rules = {'myField': 'required'} v.fields = {'myfield': 'Hello World'} try: v.verify_fields() except ValueError as e: self.assertRaisesRegexp(e, 'fields do not correspond to rules')
def test_verify_messages_fail(self): v = Validator() v.rules = {'myField': 'required'} v.fields = {'myField': 'Hello World'} v.messages_temp = {'requared': 'this thing is going to crash !!'} try: v.verify_fields() except ValueError as e: self.assertRaisesRegexp(e, 'custom validation messages do not correspond to rule list')