Merge pull request #156 from Infinidat/pull_request_1
fix httplib NameError
This commit is contained in:
		| @@ -1036,7 +1036,7 @@ class SSLTunnelConnection(object): | |||||||
|       tunnel.request('CONNECT', self.proxyPath) |       tunnel.request('CONNECT', self.proxyPath) | ||||||
|       resp = tunnel.getresponse() |       resp = tunnel.getresponse() | ||||||
|       if resp.status != 200: |       if resp.status != 200: | ||||||
|         raise httplib.HTTPException("{0} {1}".format(resp.status, resp.reason)) |         raise http_client.HTTPException("{0} {1}".format(resp.status, resp.reason)) | ||||||
|       retval = http_client.HTTPSConnection(path) |       retval = http_client.HTTPSConnection(path) | ||||||
|       retval.sock = _SocketWrapper(tunnel.sock, |       retval.sock = _SocketWrapper(tunnel.sock, | ||||||
|                                    keyfile=key_file, certfile=cert_file) |                                    keyfile=key_file, certfile=cert_file) | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								tests/fixtures/ssl_tunnel_http_failure.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								tests/fixtures/ssl_tunnel_http_failure.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | interactions: | ||||||
|  | - request: | ||||||
|  |     body: null | ||||||
|  |     headers: {} | ||||||
|  |     method: CONNECT | ||||||
|  |     uri: http://vcsavcsa:80 | ||||||
|  |   response: | ||||||
|  |     body: {string: !!python/unicode '<HTML><BODY><H1>404 Not Found</H1></BODY></HTML>'} | ||||||
|  |     headers: | ||||||
|  |       connection: [close] | ||||||
|  |       content-length: ['48'] | ||||||
|  |       content-type: [text/html] | ||||||
|  |       date: ['Thu, 11 Sep 2014 07:57:56 GMT'] | ||||||
|  |     status: {code: 404, message: Not Found} | ||||||
|  | version: 1 | ||||||
| @@ -74,5 +74,14 @@ class ConnectionTests(tests.VCRTestBase): | |||||||
|     def test_ssl_tunnel(self): |     def test_ssl_tunnel(self): | ||||||
|         connect.SoapStubAdapter('sdkTunnel', 8089, httpProxyHost='vcsa').GetConnection() |         connect.SoapStubAdapter('sdkTunnel', 8089, httpProxyHost='vcsa').GetConnection() | ||||||
|  |  | ||||||
|  |     @vcr.use_cassette('ssl_tunnel_http_failure.yaml', | ||||||
|  |                       cassette_library_dir=tests.fixtures_path, | ||||||
|  |                       record_mode='none') | ||||||
|  |     def test_ssl_tunnel_http_failure(self): | ||||||
|  |         from six.moves import http_client | ||||||
|  |         def should_fail(): | ||||||
|  |             connect.SoapStubAdapter('vcsa', 80, httpProxyHost='vcsa').GetConnection() | ||||||
|  |         self.assertRaises(http_client.HTTPException, should_fail) | ||||||
|  |  | ||||||
| if __name__ == '__main__': | if __name__ == '__main__': | ||||||
|     unittest.main() |     unittest.main() | ||||||
		Reference in New Issue
	
	Block a user
	 Shawn Hartsock
					Shawn Hartsock