@@ -165,18 +165,19 @@ def test_proxy_environment_variables_respected(self):
165165 """
166166 Test that proxy environment variables are respected by the underlying Requests library
167167 """
168+
168169 def mock_send (self , request , ** kwargs ):
169- captured_proxies .update (kwargs .get (' proxies' , {}))
170+ captured_proxies .update (kwargs .get (" proxies" , {}))
170171 nonlocal captured_url
171172 captured_url = request .url
172173 mock_response = Mock ()
173174 mock_response .status_code = 200
174- mock_response .headers = {' content-type' : ' application/json' , ' location' : '' }
175+ mock_response .headers = {" content-type" : " application/json" , " location" : "" }
175176 mock_response .text = "OK"
176177 mock_response .history = [] # No redirects
177178 return mock_response
178-
179- with patch .object (HTTPAdapter , ' send' , mock_send ):
179+
180+ with patch .object (HTTPAdapter , " send" , mock_send ):
180181 os .environ ["http_proxy" ] = "http://proxy.example.com:8080"
181182 os .environ ["https_proxy" ] = "https://secure-proxy.example.com:8443"
182183 os .environ ["no_proxy" ] = "localhost,127.0.0.1"
@@ -187,13 +188,15 @@ def mock_send(self, request, **kwargs):
187188 conn .request ("GET" , "/get" )
188189
189190 self .assertEqual (captured_proxies , {})
190- self .assertIn (' localhost' , captured_url )
191+ self .assertIn (" localhost" , captured_url )
191192
192193 conn = LibcloudConnection (host = "test.com" , port = 80 )
193194 conn .request ("GET" , "/get" )
194195
195- self .assertEqual (captured_proxies .get ('http' , None ), 'http://proxy.example.com:8080' )
196- self .assertEqual (captured_proxies .get ('https' , None ), 'https://secure-proxy.example.com:8443' )
196+ self .assertEqual (captured_proxies .get ("http" , None ), "http://proxy.example.com:8080" )
197+ self .assertEqual (
198+ captured_proxies .get ("https" , None ), "https://secure-proxy.example.com:8443"
199+ )
197200
198201 def test_connection_to_unusual_port (self ):
199202 conn = LibcloudConnection (host = "localhost" , port = 8080 )
0 commit comments