Browse Source

* Another fix - for test_utils proxy test

git-svn-id: http://proj.badc.rl.ac.uk/svn/ndg-security/trunk/ndg_httpsclient@7994 051b1e3e-aa0c-0410-b6c2-bfbade6052be
pjkersha 13 years ago
parent
commit
b13ce4b451
1 changed files with 11 additions and 1 deletions
  1. 11 1
      ndg/httpsclient/test/test_utils.py

+ 11 - 1
ndg/httpsclient/test/test_utils.py

@@ -39,13 +39,23 @@ class TestUtilsModule(unittest.TestCase):
                          'open_url for %r failed' % Constants.TEST_URI)
         
     def test04__should_use_proxy(self):
+        if 'no_proxy' in os.environ:
+            no_proxy = os.environ['no_proxy']
+            del os.environ['no_proxy']
+        else:
+            no_proxy = None
+               
         self.assertTrue(_should_use_proxy(Constants.TEST_URI), 
                         'Expecting use proxy = True')
         
         os.environ['no_proxy'] = 'localhost,localhost.localdomain'
         self.assertFalse(_should_use_proxy(Constants.TEST_URI), 
                          'Expecting use proxy = False')
-        del os.environ['no_proxy']
+        
+        if no_proxy is not None:
+            os.environ['no_proxy'] = no_proxy
+        else:
+            del os.environ['no_proxy']
     
 if __name__ == "__main__":
     unittest.main()