Regression test for #1330 (Coerce None to '')

This commit is contained in:
Yuri Prezument 2014-01-05 15:16:55 +02:00
parent 52686420f4
commit 46f5c62530

View File

@ -1124,6 +1124,20 @@ class BlankFieldTests(TestCase):
serializer = self.model_serializer_class(data={})
self.assertEqual(serializer.is_valid(), True)
def test_create_model_null_field_save(self):
"""
Regression test for #1330.
https://github.com/tomchristie/django-rest-framework/pull/1330
"""
serializer = self.model_serializer_class(data={'title': None})
self.assertEqual(serializer.is_valid(), True)
try:
serializer.save()
except Exception:
self.fail('Exception raised on save() after validation passes')
#test for issue #460
class SerializerPickleTests(TestCase):