mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 04:07:39 +03:00
Add failed testcase for fieldvalidation
This commit is contained in:
parent
2c76212e54
commit
dc1c57d595
|
@ -241,6 +241,14 @@ class ValidationTests(TestCase):
|
|||
self.assertFalse(serializer.is_valid())
|
||||
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):
|
||||
"""
|
||||
Data of the wrong type is not valid.
|
||||
|
|
Loading…
Reference in New Issue
Block a user