@@ -176,30 +176,30 @@ def test_head_method_serializes_no_content(self):
176176
177177 def test_default_renderer_serializes_content_on_accept_any (self ):
178178 """If the Accept header is set to */* the default renderer should serialize the response."""
179- resp = self .client .get ('/' , HTTP_ACCEPT = '*/*' )
179+ resp = self .client .get ('/' , headers = { "accept" : '*/*' } )
180180 self .assertEqual (resp ['Content-Type' ], RendererA .media_type + '; charset=utf-8' )
181181 self .assertEqual (resp .content , RENDERER_A_SERIALIZER (DUMMYCONTENT ))
182182 self .assertEqual (resp .status_code , DUMMYSTATUS )
183183
184184 def test_specified_renderer_serializes_content_default_case (self ):
185185 """If the Accept header is set the specified renderer should serialize the response.
186186 (In this case we check that works for the default renderer)"""
187- resp = self .client .get ('/' , HTTP_ACCEPT = RendererA .media_type )
187+ resp = self .client .get ('/' , headers = { "accept" : RendererA .media_type } )
188188 self .assertEqual (resp ['Content-Type' ], RendererA .media_type + '; charset=utf-8' )
189189 self .assertEqual (resp .content , RENDERER_A_SERIALIZER (DUMMYCONTENT ))
190190 self .assertEqual (resp .status_code , DUMMYSTATUS )
191191
192192 def test_specified_renderer_serializes_content_non_default_case (self ):
193193 """If the Accept header is set the specified renderer should serialize the response.
194194 (In this case we check that works for a non-default renderer)"""
195- resp = self .client .get ('/' , HTTP_ACCEPT = RendererB .media_type )
195+ resp = self .client .get ('/' , headers = { "accept" : RendererB .media_type } )
196196 self .assertEqual (resp ['Content-Type' ], RendererB .media_type + '; charset=utf-8' )
197197 self .assertEqual (resp .content , RENDERER_B_SERIALIZER (DUMMYCONTENT ))
198198 self .assertEqual (resp .status_code , DUMMYSTATUS )
199199
200200 def test_unsatisfiable_accept_header_on_request_returns_406_status (self ):
201201 """If the Accept header is unsatisfiable we should return a 406 Not Acceptable response."""
202- resp = self .client .get ('/' , HTTP_ACCEPT = 'foo/bar' )
202+ resp = self .client .get ('/' , headers = { "accept" : 'foo/bar' } )
203203 self .assertEqual (resp .status_code , status .HTTP_406_NOT_ACCEPTABLE )
204204
205205 def test_specified_renderer_serializes_content_on_format_query (self ):
@@ -230,14 +230,14 @@ def test_specified_renderer_is_used_on_format_query_with_matching_accept(self):
230230 RendererB .format
231231 )
232232 resp = self .client .get ('/' + param ,
233- HTTP_ACCEPT = RendererB .media_type )
233+ headers = { "accept" : RendererB .media_type } )
234234 self .assertEqual (resp ['Content-Type' ], RendererB .media_type + '; charset=utf-8' )
235235 self .assertEqual (resp .content , RENDERER_B_SERIALIZER (DUMMYCONTENT ))
236236 self .assertEqual (resp .status_code , DUMMYSTATUS )
237237
238238 def test_parse_error_renderers_browsable_api (self ):
239239 """Invalid data should still render the browsable API correctly."""
240- resp = self .client .post ('/parseerror' , data = 'foobar' , content_type = 'application/json' , HTTP_ACCEPT = 'text/html' )
240+ resp = self .client .post ('/parseerror' , data = 'foobar' , content_type = 'application/json' , headers = { "accept" : 'text/html' } )
241241 self .assertEqual (resp ['Content-Type' ], 'text/html; charset=utf-8' )
242242 self .assertEqual (resp .status_code , status .HTTP_400_BAD_REQUEST )
243243
@@ -795,13 +795,13 @@ class DummyView:
795795 assert result is None
796796
797797 def test_extra_actions_dropdown (self ):
798- resp = self .client .get ('/api/examples/' , HTTP_ACCEPT = 'text/html' )
798+ resp = self .client .get ('/api/examples/' , headers = { "accept" : 'text/html' } )
799799 assert 'id="extra-actions-menu"' in resp .content .decode ()
800800 assert '/api/examples/list_action/' in resp .content .decode ()
801801 assert '>Extra list action<' in resp .content .decode ()
802802
803803 def test_extra_actions_dropdown_not_authed (self ):
804- resp = self .client .get ('/api/unauth-examples/' , HTTP_ACCEPT = 'text/html' )
804+ resp = self .client .get ('/api/unauth-examples/' , headers = { "accept" : 'text/html' } )
805805 assert 'id="extra-actions-menu"' not in resp .content .decode ()
806806 assert '/api/examples/list_action/' not in resp .content .decode ()
807807 assert '>Extra list action<' not in resp .content .decode ()
0 commit comments