def test_custom_converters(self): self.assertEqual(type(self.form.email), fields.TextField) self.assertTrue(contains_validator(self.form.email, validators.Email)) self.assertEqual(type(self.form.reg_ip), fields.TextField) self.assertTrue( contains_validator(self.form.reg_ip, validators.IPAddress)) self.assertEqual(type(self.form.group_id), ModelSelectField)
def test_field_args(self): self.assertTrue(contains_validator(self.form.posts, validators.NumberRange)) self.assertEqual(self.form.posts.description, 'Test')
def test_optional(self): self.assertTrue(contains_validator(self.form.email, validators.Optional))
def test_max_length(self): self.assertTrue(contains_validator(self.form.username, validators.Length)) self.assertFalse(contains_validator(self.form.posts, validators.Length))
def test_custom_converters(self): self.assertEqual(type(self.form.email), fields.TextField) self.assertTrue(contains_validator(self.form.email, validators.Email)) self.assertEqual(type(self.form.reg_ip), fields.TextField) self.assertTrue(contains_validator(self.form.reg_ip, validators.IPAddress)) self.assertEqual(type(self.form.group_id), ModelSelectField)
def test_auto_validators(self): student_form = model_form(self.Student, self.sess)() assert contains_validator(student_form.dob, Optional) assert contains_validator(student_form.full_name, Required) assert contains_validator(student_form.full_name, Unique)
def test_auto_validators(self): student_form = model_form(self.Student, self.sess)() assert contains_validator(student_form.dob, Optional) assert contains_validator(student_form.full_name, Required)