def test_direct_validate_fail(self): v = Validator() v.validate('gibberish', 'url') self.assertTrue(v.fails()) self.assertTrue('gibberish must be a valid url' in v.errors())
def test_direct_validate_pass(self): v = Validator() v.validate('http://google.com', 'url') self.assertFalse(v.fails()) self.assertFalse(v.errors())
def test_direct_validate_multiple_fail(self): v = Validator() v.validate(22, 'min:43') self.assertTrue(v.fails()) self.assertTrue('22 must be higher than 43' in v.errors())