@@ -174,30 +174,30 @@ def test_head_method_serializes_no_content(self):
174174
175175 def test_default_renderer_serializes_content_on_accept_any (self ):
176176 """If the Accept header is set to */* the default renderer should serialize the response."""
177- resp = self .client .get ('/' , HTTP_ACCEPT = '*/*' )
177+ resp = self .client .get ('/' , headers = { "accept" : '*/*' } )
178178 self .assertEqual (resp ['Content-Type' ], RendererA .media_type + '; charset=utf-8' )
179179 self .assertEqual (resp .content , RENDERER_A_SERIALIZER (DUMMYCONTENT ))
180180 self .assertEqual (resp .status_code , DUMMYSTATUS )
181181
182182 def test_specified_renderer_serializes_content_default_case (self ):
183183 """If the Accept header is set the specified renderer should serialize the response.
184184 (In this case we check that works for the default renderer)"""
185- resp = self .client .get ('/' , HTTP_ACCEPT = RendererA .media_type )
185+ resp = self .client .get ('/' , headers = { "accept" : RendererA .media_type } )
186186 self .assertEqual (resp ['Content-Type' ], RendererA .media_type + '; charset=utf-8' )
187187 self .assertEqual (resp .content , RENDERER_A_SERIALIZER (DUMMYCONTENT ))
188188 self .assertEqual (resp .status_code , DUMMYSTATUS )
189189
190190 def test_specified_renderer_serializes_content_non_default_case (self ):
191191 """If the Accept header is set the specified renderer should serialize the response.
192192 (In this case we check that works for a non-default renderer)"""
193- resp = self .client .get ('/' , HTTP_ACCEPT = RendererB .media_type )
193+ resp = self .client .get ('/' , headers = { "accept" : RendererB .media_type } )
194194 self .assertEqual (resp ['Content-Type' ], RendererB .media_type + '; charset=utf-8' )
195195 self .assertEqual (resp .content , RENDERER_B_SERIALIZER (DUMMYCONTENT ))
196196 self .assertEqual (resp .status_code , DUMMYSTATUS )
197197
198198 def test_unsatisfiable_accept_header_on_request_returns_406_status (self ):
199199 """If the Accept header is unsatisfiable we should return a 406 Not Acceptable response."""
200- resp = self .client .get ('/' , HTTP_ACCEPT = 'foo/bar' )
200+ resp = self .client .get ('/' , headers = { "accept" : 'foo/bar' } )
201201 self .assertEqual (resp .status_code , status .HTTP_406_NOT_ACCEPTABLE )
202202
203203 def test_specified_renderer_serializes_content_on_format_query (self ):
@@ -228,14 +228,14 @@ def test_specified_renderer_is_used_on_format_query_with_matching_accept(self):
228228 RendererB .format
229229 )
230230 resp = self .client .get ('/' + param ,
231- HTTP_ACCEPT = RendererB .media_type )
231+ headers = { "accept" : RendererB .media_type } )
232232 self .assertEqual (resp ['Content-Type' ], RendererB .media_type + '; charset=utf-8' )
233233 self .assertEqual (resp .content , RENDERER_B_SERIALIZER (DUMMYCONTENT ))
234234 self .assertEqual (resp .status_code , DUMMYSTATUS )
235235
236236 def test_parse_error_renderers_browsable_api (self ):
237237 """Invalid data should still render the browsable API correctly."""
238- resp = self .client .post ('/parseerror' , data = 'foobar' , content_type = 'application/json' , HTTP_ACCEPT = 'text/html' )
238+ resp = self .client .post ('/parseerror' , data = 'foobar' , content_type = 'application/json' , headers = { "accept" : 'text/html' } )
239239 self .assertEqual (resp ['Content-Type' ], 'text/html; charset=utf-8' )
240240 self .assertEqual (resp .status_code , status .HTTP_400_BAD_REQUEST )
241241
@@ -714,13 +714,13 @@ class DummyView:
714714 assert result is None
715715
716716 def test_extra_actions_dropdown (self ):
717- resp = self .client .get ('/api/examples/' , HTTP_ACCEPT = 'text/html' )
717+ resp = self .client .get ('/api/examples/' , headers = { "accept" : 'text/html' } )
718718 assert 'id="extra-actions-menu"' in resp .content .decode ()
719719 assert '/api/examples/list_action/' in resp .content .decode ()
720720 assert '>Extra list action<' in resp .content .decode ()
721721
722722 def test_extra_actions_dropdown_not_authed (self ):
723- resp = self .client .get ('/api/unauth-examples/' , HTTP_ACCEPT = 'text/html' )
723+ resp = self .client .get ('/api/unauth-examples/' , headers = { "accept" : 'text/html' } )
724724 assert 'id="extra-actions-menu"' not in resp .content .decode ()
725725 assert '/api/examples/list_action/' not in resp .content .decode ()
726726 assert '>Extra list action<' not in resp .content .decode ()
0 commit comments