Add failed testcase for fieldvalidation

This commit is contained in:
Stephan Groß 2013-01-21 12:45:30 +01:00
parent 2c76212e54
commit dc1c57d595

View File

@ -241,6 +241,14 @@ class ValidationTests(TestCase):
self.assertFalse(serializer.is_valid()) self.assertFalse(serializer.is_valid())
self.assertEquals(serializer.errors, {'content': [u'Test not in value']}) self.assertEquals(serializer.errors, {'content': [u'Test not in value']})
incomplete_data = {
'email': 'tom@example.com',
'created': datetime.datetime(2012, 1, 1)
}
serializer = CommentSerializerWithFieldValidator(data=incomplete_data)
self.assertFalse(serializer.is_valid())
self.assertEquals(serializer.errors, {'content': [u'This field is required.']})
def test_bad_type_data_is_false(self): def test_bad_type_data_is_false(self):
""" """
Data of the wrong type is not valid. Data of the wrong type is not valid.