diff options
| author | Yuri Prezument | 2013-02-21 12:15:31 +0200 |
|---|---|---|
| committer | Yuri Prezument | 2013-02-21 12:22:09 +0200 |
| commit | 1b4c078db2e0d23dbb970fbf5790db843377dc11 (patch) | |
| tree | 69827a3a1663b0dd88198de1fb01db68256e8e23 /rest_framework/tests/serializer.py | |
| parent | 47a4f0863d08e4b839ea3bbd7308ecc0f995b7d9 (diff) | |
| download | django-rest-framework-1b4c078db2e0d23dbb970fbf5790db843377dc11.tar.bz2 | |
Failing test case for #669
Diffstat (limited to 'rest_framework/tests/serializer.py')
| -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..24a2d644 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) + + # TODO: check validation error value + class CustomValidationTests(TestCase): class CommentSerializerWithFieldValidator(CommentSerializer): |
