Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 def test_field_args(self):
     self.assertTrue(contains_validator(self.form.posts, validators.NumberRange))
     self.assertEqual(self.form.posts.description, 'Test')
Ejemplo n.º 3
0
 def test_optional(self):
     self.assertTrue(contains_validator(self.form.email, validators.Optional))
Ejemplo n.º 4
0
 def test_max_length(self):
     self.assertTrue(contains_validator(self.form.username, validators.Length))
     self.assertFalse(contains_validator(self.form.posts, validators.Length))
Ejemplo n.º 5
0
 def test_field_args(self):
     self.assertTrue(contains_validator(self.form.posts, validators.NumberRange))
     self.assertEqual(self.form.posts.description, 'Test')
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 def test_optional(self):
     self.assertTrue(contains_validator(self.form.email, validators.Optional))
Ejemplo n.º 8
0
 def test_max_length(self):
     self.assertTrue(contains_validator(self.form.username, validators.Length))
     self.assertFalse(contains_validator(self.form.posts, validators.Length))
Ejemplo n.º 9
0
 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)