diff options
Diffstat (limited to 'rest_framework/tests')
| -rw-r--r-- | rest_framework/tests/serializer.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rest_framework/tests/serializer.py b/rest_framework/tests/serializer.py index da110138..e85323e0 100644 --- a/rest_framework/tests/serializer.py +++ b/rest_framework/tests/serializer.py @@ -338,6 +338,21 @@ class ValidationTests(TestCase): self.assertEquals(serializer.is_valid(), False) self.assertEquals(serializer.errors, {'info': ['Ensure this value has at most 12 characters (it has 13).']}) + def test_datetime_validation_failure(self): + """ + Test DateTimeField validation errors on non-str values. + Regression test for #669. + + https://github.com/tomchristie/django-rest-framework/issues/669 + """ + data = self.data + data['created'] = 0 + + serializer = CommentSerializer(data=data) + self.assertEquals(serializer.is_valid(), False) + + self.assertIn('created', serializer.errors) + class CustomValidationTests(TestCase): class CommentSerializerWithFieldValidator(CommentSerializer): |
