mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-12-04 23:44:07 +03:00
Failing unit test for issue #324
This commit is contained in:
parent
44207a347a
commit
03f801c7ff
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user