Пример #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)
Пример #2
0
 def test_field_args(self):
     self.assertTrue(contains_validator(self.form.posts, validators.NumberRange))
     self.assertEqual(self.form.posts.description, 'Test')
Пример #3
0
 def test_optional(self):
     self.assertTrue(contains_validator(self.form.email, validators.Optional))
Пример #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))
Пример #5
0
 def test_field_args(self):
     self.assertTrue(contains_validator(self.form.posts, validators.NumberRange))
     self.assertEqual(self.form.posts.description, 'Test')
Пример #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)
Пример #7
0
 def test_optional(self):
     self.assertTrue(contains_validator(self.form.email, validators.Optional))
Пример #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))
Пример #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)