add test for SSLTunnelConnection
This commit is contained in:
@@ -16,6 +16,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import vcr
|
import vcr
|
||||||
|
import socket
|
||||||
|
|
||||||
|
|
||||||
def tests_resource_path(local_path=''):
|
def tests_resource_path(local_path=''):
|
||||||
@@ -29,7 +30,7 @@ fixtures_path = tests_resource_path('fixtures')
|
|||||||
def monkey_patch_vcrpy():
|
def monkey_patch_vcrpy():
|
||||||
# TODO (hartsock): This should be unnecessary. Remove after vcrpy updates.
|
# TODO (hartsock): This should be unnecessary. Remove after vcrpy updates.
|
||||||
vcr.stubs.VCRHTTPSConnection.is_verified = True
|
vcr.stubs.VCRHTTPSConnection.is_verified = True
|
||||||
|
vcr.stubs.VCRFakeSocket = socket.socket
|
||||||
|
|
||||||
class VCRTestBase(unittest.TestCase):
|
class VCRTestBase(unittest.TestCase):
|
||||||
|
|
||||||
|
14
tests/fixtures/ssl_tunnel.yaml
vendored
Normal file
14
tests/fixtures/ssl_tunnel.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
interactions:
|
||||||
|
- request:
|
||||||
|
body: null
|
||||||
|
headers: {}
|
||||||
|
method: CONNECT
|
||||||
|
uri: http://vcsasdkTunnel:8089
|
||||||
|
response:
|
||||||
|
body: {string: !!python/unicode ''}
|
||||||
|
headers:
|
||||||
|
content-length: ['0']
|
||||||
|
content-type: [text/html]
|
||||||
|
date: ['Thu, 11 Sep 2014 08:23:36 GMT']
|
||||||
|
status: {code: 200, message: OK}
|
||||||
|
version: 1
|
@@ -68,5 +68,11 @@ class ConnectionTests(tests.VCRTestBase):
|
|||||||
def test_disconnect_on_no_connection(self):
|
def test_disconnect_on_no_connection(self):
|
||||||
connect.Disconnect(None)
|
connect.Disconnect(None)
|
||||||
|
|
||||||
|
@vcr.use_cassette('ssl_tunnel.yaml',
|
||||||
|
cassette_library_dir=tests.fixtures_path,
|
||||||
|
record_mode='none')
|
||||||
|
def test_ssl_tunnel(self):
|
||||||
|
connect.SoapStubAdapter('sdkTunnel', 8089, httpProxyHost='vcsa').GetConnection()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
Reference in New Issue
Block a user