Exemplo 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'
Exemplo 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"
Exemplo 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"
Exemplo 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"
Exemplo n.º 5
0
 def test_localHostOrDomainIs(self):
     parser = PACFile(dummy_js % 'localHostOrDomainIs(host, "www.netscape.com")')
     assert parser.find_proxy_for_url('/', 'www') == 'DIRECT'
Exemplo 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'
Exemplo 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'
Exemplo 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'
Exemplo 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
Exemplo 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
Exemplo n.º 11
0
 def test_localHostOrDomainIs(self):
     parser = PACFile(dummy_js % 'localHostOrDomainIs(host, "www.netscape.com")')
     assert parser.find_proxy_for_url('/', 'www') == 'DIRECT'
Exemplo 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
Exemplo 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'
Exemplo 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'
Exemplo 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'
Exemplo 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"
Exemplo 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'
Exemplo 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"
Exemplo 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'
Exemplo 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'
Exemplo 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'
Exemplo 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'
Exemplo 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"
Exemplo 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'
Exemplo 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"
Exemplo 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'
Exemplo 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"
Exemplo 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
Exemplo 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'