Add support for using cloud_id when instantiating conections (#957)

* add cloud_id

* adding doc strings

* update changelog

* adding some tests to check for cloud_id

* update the read me
This commit is contained in:
Nick Lang
2019-05-21 21:21:34 -05:00
committed by GitHub
parent e1968ed95a
commit 60d254860b
5 changed files with 54 additions and 4 deletions
+18
View File
@@ -34,6 +34,15 @@ class TestUrllib3Connection(TestCase):
self.assertIsInstance(con.pool.conn_kw["ssl_context"], ssl.SSLContext)
self.assertTrue(con.use_ssl)
def test_http_cloud_id(self):
con = Urllib3HttpConnection(
cloud_id="foobar:ZXhhbXBsZS5jbG91ZC5jb20kMGZkNTBmNjIzMjBlZDY1MzlmNmNiNDhlMWI2OCRhYzUzOTVhODgz\nNDU2NmM5ZjE1Y2Q4ZTQ5MGE=\n"
)
self.assertTrue(con.use_ssl)
self.assertEquals(
con.host, "https://0fd50f62320ed6539f6cb48e1b68.example.cloud.com:9243"
)
def test_http_compression(self):
con = Urllib3HttpConnection(http_compress=True)
self.assertTrue(con.http_compress)
@@ -151,6 +160,15 @@ class TestRequestsConnection(TestCase):
con = RequestsHttpConnection(timeout=42)
self.assertEquals(42, con.timeout)
def test_http_cloud_id(self):
con = RequestsHttpConnection(
cloud_id="foobar:ZXhhbXBsZS5jbG91ZC5jb20kMGZkNTBmNjIzMjBlZDY1MzlmNmNiNDhlMWI2OCRhYzUzOTVhODgz\nNDU2NmM5ZjE1Y2Q4ZTQ5MGE=\n"
)
self.assertTrue(con.use_ssl)
self.assertEquals(
con.host, "https://0fd50f62320ed6539f6cb48e1b68.example.cloud.com:9243"
)
def test_uses_https_if_verify_certs_is_off(self):
with warnings.catch_warnings(record=True) as w:
con = self._get_mock_connection(