Esempio n. 1
0
 def test_dnsResolve_propagation(self):
     """
     dnsResolve must return an empty string now we use dukpy, otherwise
     None value causes dukpy error as it propagates
     """
     parser = PACFile(dummy_js % 'isInNet(dnsResolve(host), "10.1.1.0", "255.255.255.0")')
     assert parser.find_proxy_for_url('$%$', '$%$') == 'PROXY 0.0.0.0:80'
Esempio n. 2
0
 def test_dnsResolve_propagation(self):
     """
     dnsResolve must return an empty string now we use dukpy, otherwise
     None value causes dukpy error as it propagates
     """
     parser = PACFile(
         dummy_js %
         'isInNet(dnsResolve(host), "10.1.1.0", "255.255.255.0")')
     assert parser.find_proxy_for_url("$%$", "$%$") == "PROXY 0.0.0.0:80"
Esempio n. 3
0
 def test_shExpMatch(self):
     parser = PACFile(dummy_js % 'shExpMatch(host, "*.example.com")')
     assert parser.find_proxy_for_url("/", "www.example.com") == "DIRECT"
     assert parser.find_proxy_for_url(
         "/", "www.example.org") == "PROXY 0.0.0.0:80"
Esempio n. 4
0
 def test_dnsDomainIs(self):
     parser = PACFile(dummy_js % 'dnsDomainIs(host, "example.com")')
     assert parser.find_proxy_for_url("/", "www.example.com") == "DIRECT"
Esempio n. 5
0
 def test_localHostOrDomainIs(self):
     parser = PACFile(dummy_js % 'localHostOrDomainIs(host, "www.netscape.com")')
     assert parser.find_proxy_for_url('/', 'www') == 'DIRECT'
Esempio n. 6
0
 def test_isPlainHostName(self):
     parser = PACFile(dummy_js % 'isPlainHostName(host)')
     assert parser.find_proxy_for_url('/', 'google.com') != 'DIRECT'
     assert parser.find_proxy_for_url('/', 'foobar') == 'DIRECT'
Esempio n. 7
0
 def test_shExpMatch(self):
     parser = PACFile(dummy_js % 'shExpMatch(host, "*.example.com")')
     assert parser.find_proxy_for_url('/', 'www.example.com') == 'DIRECT'
     assert parser.find_proxy_for_url('/', 'www.example.org') == 'PROXY 0.0.0.0:80'
Esempio n. 8
0
 def test_isResolvable(self):
     parser = PACFile(dummy_js % 'isResolvable(host)')
     assert parser.find_proxy_for_url('/', 'www.google.com') == 'DIRECT'
     assert parser.find_proxy_for_url('/', 'bogus.domain.local') != 'DIRECT'
Esempio n. 9
0
 def test_dnsResolve(self):
     js = 'function FindProxyForURL(url, host) {return "PROXY " + dnsResolve(host) + ":80"; }'
     parser = PACFile(js)
     assert parser.find_proxy_for_url('/', 'www.google.com') is not None
Esempio n. 10
0
 def test_dnsResolve(self):
     js = 'function FindProxyForURL(url, host) {return "PROXY " + dnsResolve(host) + ":80"; }'
     parser = PACFile(js)
     assert parser.find_proxy_for_url('/', 'www.google.com') is not None
Esempio n. 11
0
 def test_localHostOrDomainIs(self):
     parser = PACFile(dummy_js % 'localHostOrDomainIs(host, "www.netscape.com")')
     assert parser.find_proxy_for_url('/', 'www') == 'DIRECT'
Esempio n. 12
0
 def test_myIpAddress(self):
     js = 'function FindProxyForURL(url, host) {return "PROXY " + myIpAddress() + ":80"; }'
     parser = PACFile(js)
     assert parser.find_proxy_for_url('/', 'www.example.com') is not None
Esempio n. 13
0
 def test_isInNet(self):
     parser = PACFile(dummy_js % 'isInNet(host, "0.0.0.0", "0.0.0.0")')
     assert parser.find_proxy_for_url('/', 'www.google.com') == 'DIRECT'
Esempio n. 14
0
 def test_isResolvable(self):
     parser = PACFile(dummy_js % 'isResolvable(host)')
     assert parser.find_proxy_for_url('/', 'www.google.com') == 'DIRECT'
     assert parser.find_proxy_for_url('/', 'bogus.domain.local') != 'DIRECT'
Esempio n. 15
0
 def test_dnsDomainIs(self):
     parser = PACFile(dummy_js % 'dnsDomainIs(host, "*.example.com")')
     assert parser.find_proxy_for_url('/', 'www.example.com') == 'DIRECT'
Esempio n. 16
0
 def test_isResolvable(self):
     parser = PACFile(dummy_js % "isResolvable(host)")
     assert parser.find_proxy_for_url("/", "www.google.com") == "DIRECT"
     assert parser.find_proxy_for_url("/", "bogus.domain.local") != "DIRECT"
Esempio n. 17
0
 def test_isPlainHostName(self):
     parser = PACFile(dummy_js % 'isPlainHostName(host)')
     assert parser.find_proxy_for_url('/', 'google.com') != 'DIRECT'
     assert parser.find_proxy_for_url('/', 'foobar') == 'DIRECT'
Esempio n. 18
0
 def test_isInNet(self):
     parser = PACFile(dummy_js % 'isInNet(host, "0.0.0.0", "0.0.0.0")')
     assert parser.find_proxy_for_url("/", "www.google.com") == "DIRECT"
Esempio n. 19
0
 def test_shExpMatch(self):
     parser = PACFile(dummy_js % 'shExpMatch(host, "*.example.com")')
     assert parser.find_proxy_for_url('/', 'www.example.com') == 'DIRECT'
     assert parser.find_proxy_for_url('/', 'www.example.org') == 'PROXY 0.0.0.0:80'
Esempio n. 20
0
 def test_dnsDomainLevels(self):
     parser = PACFile(dummy_js % 'dnsDomainLevels(host)')
     assert parser.find_proxy_for_url('/', 'google.com') == 'DIRECT'
     assert parser.find_proxy_for_url('/', 'foobar') != 'DIRECT'
Esempio n. 21
0
 def test_valid_js_function_signatures(self, pac_js):
     pac = PACFile(pac_js)
     assert pac.find_proxy_for_url('/', 'example.com') == 'DIRECT'
Esempio n. 22
0
 def test_valid_js_function_signatures(self, pac_js):
     pac = PACFile(pac_js)
     assert pac.find_proxy_for_url('/', 'example.com') == 'DIRECT'
Esempio n. 23
0
 def test_dnsDomainLevels(self):
     parser = PACFile(dummy_js % "dnsDomainLevels(host)")
     assert parser.find_proxy_for_url("/", "google.com") == "DIRECT"
     assert parser.find_proxy_for_url("/", "foobar") != "DIRECT"
Esempio n. 24
0
 def test_dnsDomainIs(self):
     parser = PACFile(dummy_js % 'dnsDomainIs(host, "*.example.com")')
     assert parser.find_proxy_for_url('/', 'www.example.com') == 'DIRECT'
Esempio n. 25
0
 def test_isPlainHostName(self):
     parser = PACFile(dummy_js % "isPlainHostName(host)")
     assert parser.find_proxy_for_url("/", "google.com") != "DIRECT"
     assert parser.find_proxy_for_url("/", "foobar") == "DIRECT"
Esempio n. 26
0
 def test_isInNet(self):
     parser = PACFile(dummy_js % 'isInNet(host, "0.0.0.0", "0.0.0.0")')
     assert parser.find_proxy_for_url('/', 'www.google.com') == 'DIRECT'
Esempio n. 27
0
 def test_valid_js_function_signatures(self, pac_js):
     pac = PACFile(pac_js)
     assert pac.find_proxy_for_url("/", "example.com") == "DIRECT"
Esempio n. 28
0
 def test_myIpAddress(self):
     js = 'function FindProxyForURL(url, host) {return "PROXY " + myIpAddress() + ":80"; }'
     parser = PACFile(js)
     assert parser.find_proxy_for_url('/', 'www.example.com') is not None
Esempio n. 29
0
 def test_dnsDomainLevels(self):
     parser = PACFile(dummy_js % 'dnsDomainLevels(host)')
     assert parser.find_proxy_for_url('/', 'google.com') == 'DIRECT'
     assert parser.find_proxy_for_url('/', 'foobar') != 'DIRECT'