Failing unit test for issue #324

This commit is contained in:
Ian Strachan 2012-10-27 15:37:02 +01:00
parent 44207a347a
commit 03f801c7ff
2 changed files with 20 additions and 0 deletions

View File

@ -111,3 +111,7 @@ class BlogPost(RESTFrameworkModel):
class BlogPostComment(RESTFrameworkModel): class BlogPostComment(RESTFrameworkModel):
text = models.TextField() text = models.TextField()
blog_post = models.ForeignKey(BlogPost) blog_post = models.ForeignKey(BlogPost)
# Model for issue #324
class BlankFieldModel(RESTFrameworkModel):
title = models.CharField(max_length=100, blank=True)

View File

@ -436,3 +436,19 @@ class ManyRelatedTests(TestCase):
} }
self.assertEqual(serializer.data, expected) self.assertEqual(serializer.data, expected)
# Test for issue #324
class BlankFieldTests(TestCase):
def setUp(self):
class BlankFieldModelSerializer(serializers.ModelSerializer):
class Meta:
model = BlankFieldModel
self.serializer_class = BlankFieldModelSerializer
def test_create_blank_field(self):
data = {'title': ''}
serializer = self.serializer_class(data)
self.assertEquals(serializer.is_valid(), True)