Example #1
0
    def test_config_no_proxy_custom_cls(self):
        class CustomPoolManager(urllib3.PoolManager):
            pass

        manager = default_urllib3_manager(config=ConfigDict(),
                                          pool_manager_cls=CustomPoolManager)
        self.assertIsInstance(manager, CustomPoolManager)
Example #2
0
    def test_config_proxy_custom_cls(self):
        class CustomProxyManager(urllib3.ProxyManager):
            pass

        config = ConfigDict()
        config.set(b'http', b'proxy', b'http://localhost:3128/')
        manager = default_urllib3_manager(config=config,
                                          proxy_manager_cls=CustomProxyManager)
        self.assertIsInstance(manager, CustomProxyManager)
Example #3
0
    def test_config_proxy(self):
        config = ConfigDict()
        config.set(b'http', b'proxy', b'http://localhost:3128/')
        manager = default_urllib3_manager(config=config)

        self.assertIsInstance(manager, urllib3.ProxyManager)
        self.assertTrue(hasattr(manager, 'proxy'))
        self.assertEqual(manager.proxy.scheme, 'http')
        self.assertEqual(manager.proxy.host, 'localhost')
        self.assertEqual(manager.proxy.port, 3128)
Example #4
0
    def test_config_proxy(self):
        config = ConfigDict()
        config.set(b'http', b'proxy', b'http://localhost:3128/')
        manager = default_urllib3_manager(config=config)

        self.assertIsInstance(manager, urllib3.ProxyManager)
        self.assertTrue(hasattr(manager, 'proxy'))
        self.assertEqual(manager.proxy.scheme, 'http')
        self.assertEqual(manager.proxy.host, 'localhost')
        self.assertEqual(manager.proxy.port, 3128)
Example #5
0
 def test_config_no_verify_ssl(self):
     manager = default_urllib3_manager(config=None, cert_reqs="CERT_NONE")
     self.assertEqual(manager.connection_pool_kw['cert_reqs'], 'CERT_NONE')
Example #6
0
 def test_config_no_ssl(self):
     config = ConfigDict()
     config.set(b'http', b'sslVerify', b'false')
     manager = default_urllib3_manager(config=config)
     self.assertEqual(manager.connection_pool_kw['cert_reqs'], 'CERT_NONE')
Example #7
0
 def test_config_no_proxy(self):
     manager = default_urllib3_manager(config=ConfigDict())
     self.assertNotIsInstance(manager, urllib3.ProxyManager)
     self.assertIsInstance(manager, urllib3.PoolManager)
Example #8
0
 def test_no_config(self):
     manager = default_urllib3_manager(config=None)
     self.assertEqual(manager.connection_pool_kw['cert_reqs'],
                      'CERT_REQUIRED')
Example #9
0
 def test_config_no_verify_ssl(self):
     manager = default_urllib3_manager(config=None, verify_ssl=False)
     self.assert_verify_ssl(manager, assertion=False)
Example #10
0
 def test_config_no_proxy(self):
     manager = default_urllib3_manager(config=ConfigDict())
     self.assert_verify_ssl(manager)
Example #11
0
 def test_no_config(self):
     manager = default_urllib3_manager(config=None)
     self.assert_verify_ssl(manager)
Example #12
0
 def test_config_no_verify_ssl(self):
     manager = default_urllib3_manager(config=None, cert_reqs="CERT_NONE")
     self.assertEqual(manager.connection_pool_kw['cert_reqs'], 'CERT_NONE')
Example #13
0
 def test_config_no_ssl(self):
     config = ConfigDict()
     config.set(b'http', b'sslVerify', b'false')
     manager = default_urllib3_manager(config=config)
     self.assertEqual(manager.connection_pool_kw['cert_reqs'],
                      'CERT_NONE')
Example #14
0
 def test_config_no_proxy(self):
     manager = default_urllib3_manager(config=ConfigDict())
     self.assertNotIsInstance(manager, urllib3.ProxyManager)
Example #15
0
 def test_no_config(self):
     manager = default_urllib3_manager(config=None)
     self.assertEqual(manager.connection_pool_kw['cert_reqs'],
                      'CERT_REQUIRED')