mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 01:57:00 +03:00
Test for #552.
This commit is contained in:
parent
a57c0c5aae
commit
d6628d4e78
|
@ -262,6 +262,11 @@ class CustomField(serializers.Field):
|
|||
class BasicModelSerializer(serializers.Serializer):
|
||||
text = CustomField()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(BasicModelSerializer, self).__init__(*args, **kwargs)
|
||||
if not 'view' in self.context:
|
||||
raise RuntimeError("context isn't getting passed into serializer init")
|
||||
|
||||
|
||||
class TestContextPassedToCustomField(TestCase):
|
||||
def setUp(self):
|
||||
|
@ -278,4 +283,3 @@ class TestContextPassedToCustomField(TestCase):
|
|||
response = self.view(request).render()
|
||||
|
||||
self.assertEquals(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user