def test_get_no_proxy_with_values_set(self):
        no_proxy_list = ["foo.com", "www.google.com"]
        with patch.dict(os.environ, {'no_proxy': ",".join(no_proxy_list)}):
            no_proxy_from_environment = restutil.get_no_proxy()

            self.assertEqual(len(no_proxy_list),
                             len(no_proxy_from_environment))

            for i, j in zip(no_proxy_from_environment, no_proxy_list):
                self.assertEqual(i, j)
Beispiel #2
0
    def test_get_no_proxy_with_values_set(self):
        no_proxy_list = ["foo.com", "www.google.com"]
        with patch.dict(os.environ, {
            'no_proxy': ",".join(no_proxy_list)
        }):
            no_proxy_from_environment = restutil.get_no_proxy()

            self.assertEquals(len(no_proxy_list), len(no_proxy_from_environment))

            for i, j in zip(no_proxy_from_environment, no_proxy_list):
                self.assertEqual(i, j)
    def test_get_no_proxy_with_incorrect_variable_set(self):
        no_proxy_list = ["foo.com", "www.google.com", "", ""]
        no_proxy_list_cleaned = [entry for entry in no_proxy_list if entry]

        with patch.dict(os.environ, {'no_proxy': ",".join(no_proxy_list)}):
            no_proxy_from_environment = restutil.get_no_proxy()

            self.assertEqual(len(no_proxy_list_cleaned),
                             len(no_proxy_from_environment))

            for i, j in zip(no_proxy_from_environment, no_proxy_list_cleaned):
                print(i, j)
                self.assertEqual(i, j)
Beispiel #4
0
    def test_get_no_proxy_with_ip_addresses_set(self):
        no_proxy_var = "10.0.0.1,10.0.0.2,10.0.0.3,10.0.0.4,10.0.0.5,10.0.0.6,10.0.0.7,10.0.0.8,10.0.0.9,10.0.0.10,"
        no_proxy_list = ['10.0.0.1', '10.0.0.2', '10.0.0.3', '10.0.0.4', '10.0.0.5',
                         '10.0.0.6', '10.0.0.7', '10.0.0.8', '10.0.0.9', '10.0.0.10']

        with patch.dict(os.environ, {
            'no_proxy': no_proxy_var
        }):
            no_proxy_from_environment = restutil.get_no_proxy()

            self.assertEquals(len(no_proxy_list), len(no_proxy_from_environment))

            for i, j in zip(no_proxy_from_environment, no_proxy_list):
                self.assertEqual(i, j)
Beispiel #5
0
    def test_get_no_proxy_with_incorrect_variable_set(self):
        no_proxy_list = ["foo.com", "www.google.com", "", ""]
        no_proxy_list_cleaned = [entry for entry in no_proxy_list if entry]

        with patch.dict(os.environ, {
            'no_proxy': ",".join(no_proxy_list)
        }):
            no_proxy_from_environment = restutil.get_no_proxy()

            self.assertEquals(len(no_proxy_list_cleaned), len(no_proxy_from_environment))

            for i, j in zip(no_proxy_from_environment, no_proxy_list_cleaned):
                print(i, j)
                self.assertEqual(i, j)
Beispiel #6
0
    def test_get_no_proxy_with_ip_addresses_set(self):
        no_proxy_var = "10.0.0.1,10.0.0.2,10.0.0.3,10.0.0.4,10.0.0.5,10.0.0.6,10.0.0.7,10.0.0.8,10.0.0.9,10.0.0.10,"
        no_proxy_list = ['10.0.0.1', '10.0.0.2', '10.0.0.3', '10.0.0.4', '10.0.0.5',
                         '10.0.0.6', '10.0.0.7', '10.0.0.8', '10.0.0.9', '10.0.0.10']

        with patch.dict(os.environ, {
            'no_proxy': no_proxy_var
        }):
            no_proxy_from_environment = restutil.get_no_proxy()

            self.assertEqual(len(no_proxy_list), len(no_proxy_from_environment)) 

            for i, j in zip(no_proxy_from_environment, no_proxy_list):
                self.assertEqual(i, j)
Beispiel #7
0
 def test_get_no_proxy_default(self):
     no_proxy_generator = restutil.get_no_proxy()
     self.assertIsNone(no_proxy_generator)
 def test_get_no_proxy_default(self):
     no_proxy_generator = restutil.get_no_proxy()
     self.assertIsNone(no_proxy_generator)