aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests
diff options
context:
space:
mode:
authorTom Christie2012-12-14 19:59:21 +0000
committerTom Christie2012-12-14 19:59:29 +0000
commit39b01d6802310a90487f217c3de5428144c93429 (patch)
treed35997b003ec38009aeaa43a6a99be9a824fb513 /rest_framework/tests
parent9eaf8e4330e0c6a4485dba650481a2578a3979b4 (diff)
downloaddjango-rest-framework-39b01d6802310a90487f217c3de5428144c93429.tar.bz2
Ensure context is passed to dynamically added fields. Fixes #476.
Diffstat (limited to 'rest_framework/tests')
-rw-r--r--rest_framework/tests/pagination.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/rest_framework/tests/pagination.py b/rest_framework/tests/pagination.py
index 7bc23f1d..3c65e9db 100644
--- a/rest_framework/tests/pagination.py
+++ b/rest_framework/tests/pagination.py
@@ -149,7 +149,6 @@ class IntegrationTestPaginationAndFiltering(TestCase):
class PassOnContextPaginationSerializer(pagination.PaginationSerializer):
-
class Meta:
object_serializer_class = serializers.Serializer
@@ -179,9 +178,12 @@ class UnitTestPagination(TestCase):
self.assertEquals(serializer.data['results'], self.objects[20:])
def test_context_available_in_result(self):
+ """
+ Ensure context gets passed through to the object serializer.
+ """
serializer = PassOnContextPaginationSerializer(self.first_page)
+ serializer.data
results = serializer.fields[serializer.results_field]
- # assertIs is available in Python 2.7
self.assertTrue(serializer.context is results.context)