From a13262b352041ebf8ec2f6517cc968eb9e4f82e4 Mon Sep 17 00:00:00 2001 From: Arnon Yaari Date: Thu, 11 Sep 2014 11:23:38 +0300 Subject: [PATCH] add test --- tests/fixtures/ssl_tunnel_http_failure.yaml | 15 +++++++++++++++ tests/test_connect.py | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/fixtures/ssl_tunnel_http_failure.yaml diff --git a/tests/fixtures/ssl_tunnel_http_failure.yaml b/tests/fixtures/ssl_tunnel_http_failure.yaml new file mode 100644 index 0000000..ed7d739 --- /dev/null +++ b/tests/fixtures/ssl_tunnel_http_failure.yaml @@ -0,0 +1,15 @@ +interactions: +- request: + body: null + headers: {} + method: CONNECT + uri: http://vcsavcsa:80 + response: + body: {string: !!python/unicode '

404 Not Found

'} + 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 diff --git a/tests/test_connect.py b/tests/test_connect.py index 9f937ff..66c84ea 100644 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -74,5 +74,14 @@ class ConnectionTests(tests.VCRTestBase): def test_ssl_tunnel(self): 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__': unittest.main() \ No newline at end of file