Example #1
0
  def test_proxy_from_env(self):
    bootstrapper = Bootstrapper().instance()

    self.assertIsNone(bootstrapper._http_proxy())
    self.assertIsNone(bootstrapper._https_proxy())

    with environment_as(HTTP_PROXY='http://proxy.example.com:456',
                        HTTPS_PROXY='https://secure-proxy.example.com:789'):
      self.assertEquals('http://proxy.example.com:456', bootstrapper._http_proxy())
      self.assertEquals('https://secure-proxy.example.com:789', bootstrapper._https_proxy())

      self.assertEquals([
        '-Dhttp.proxyHost=proxy.example.com',
        '-Dhttp.proxyPort=456',
        '-Dhttps.proxyHost=secure-proxy.example.com',
        '-Dhttps.proxyPort=789',
      ], bootstrapper._extra_jvm_options())