add test for SSLTunnelConnection

This commit is contained in:
Arnon Yaari
2014-09-11 13:05:07 +03:00
parent abe681fcbe
commit 97b5fcf0da
3 changed files with 22 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ import logging
import os
import unittest
import vcr
import socket
def tests_resource_path(local_path=''):
@@ -29,7 +30,7 @@ fixtures_path = tests_resource_path('fixtures')
def monkey_patch_vcrpy():
# TODO (hartsock): This should be unnecessary. Remove after vcrpy updates.
vcr.stubs.VCRHTTPSConnection.is_verified = True
vcr.stubs.VCRFakeSocket = socket.socket
class VCRTestBase(unittest.TestCase):

14
tests/fixtures/ssl_tunnel.yaml vendored Normal file
View 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

View File

@@ -68,5 +68,11 @@ class ConnectionTests(tests.VCRTestBase):
def test_disconnect_on_no_connection(self):
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__':
unittest.main()