Example #1
0
    def test_get_proxy_with_items(self):
        orig_environ = os.environ
        # Set all three
        for item in ('HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY'):
            os.environ[item] = item

        # Make the test call
        proxies = util.get_proxy()

        # Check each is set
        for key, val in (('http', 'HTTP_PROXY'), ('https', 'HTTPS_PROXY'),
                         ('no_proxy', 'NO_PROXY')):
            self.assertEquals(val, proxies[key])

        # Reset environ back to the original
        os.environ = orig_environ
Example #2
0
    def test_get_proxy_with_items(self):
        orig_environ = os.environ
        # Set all three
        for item in ('HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY'):
            os.environ[item] = item

        # Make the test call
        proxies = util.get_proxy()

        # Check each is set
        for key, val in (
                ('http', 'HTTP_PROXY'),
                ('https', 'HTTPS_PROXY'),
                ('no_proxy', 'NO_PROXY')):
            self.assertEquals(val, proxies[key])

        # Reset environ back to the original
        os.environ = orig_environ
Example #3
0
 def test_get_proxy_defaults(self):
     proxies = util.get_proxy()
     # ensure each expected item exists
     for item in ('http', 'https', 'no_proxy'):
         self.assertIn(item, proxies.keys())
Example #4
0
 def test_get_proxy_defaults(self):
     proxies = util.get_proxy()
     # ensure each expected item exists
     for item in ('http', 'https', 'no_proxy'):
         self.assertIn(item, proxies.keys())