Test for setting allow_none=True for nullable CharFields

This commit is contained in:
Yuri Prezument 2014-01-06 14:02:00 +02:00
parent e1bbe9d514
commit 0fd0454a5c

View File

@ -1504,6 +1504,7 @@ class AttributeMappingOnAutogeneratedFieldsTests(TestCase):
image_field = models.ImageField(max_length=1024, blank=True)
slug_field = models.SlugField(max_length=1024, blank=True)
url_field = models.URLField(max_length=1024, blank=True)
nullable_char_field = models.CharField(max_length=1024, blank=True, null=True)
class AMOAFSerializer(serializers.ModelSerializer):
class Meta:
@ -1536,6 +1537,10 @@ class AttributeMappingOnAutogeneratedFieldsTests(TestCase):
'url_field': [
('max_length', 1024),
],
'nullable_char_field': [
('max_length', 1024),
('allow_none', True),
],
}
def field_test(self, field):
@ -1572,6 +1577,9 @@ class AttributeMappingOnAutogeneratedFieldsTests(TestCase):
def test_url_field(self):
self.field_test('url_field')
def test_nullable_char_field(self):
self.field_test('nullable_char_field')
class DefaultValuesOnAutogeneratedFieldsTests(TestCase):