Beispiel #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'
Beispiel #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"
Beispiel #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"
Beispiel #4
0
 def test_dnsDomainIs(self):
     parser = PACFile(dummy_js % 'dnsDomainIs(host, "example.com")')
     assert parser.find_proxy_for_url("/", "www.example.com") == "DIRECT"
Beispiel #5
0
 def test_localHostOrDomainIs(self):
     parser = PACFile(dummy_js % 'localHostOrDomainIs(host, "www.netscape.com")')
     assert parser.find_proxy_for_url('/', 'www') == 'DIRECT'
Beispiel #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'
Beispiel #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'
Beispiel #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'
Beispiel #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
Beispiel #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
Beispiel #11
0
 def test_localHostOrDomainIs(self):
     parser = PACFile(dummy_js % 'localHostOrDomainIs(host, "www.netscape.com")')
     assert parser.find_proxy_for_url('/', 'www') == 'DIRECT'
Beispiel #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
Beispiel #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'
Beispiel #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'
Beispiel #15
0
 def test_dnsDomainIs(self):
     parser = PACFile(dummy_js % 'dnsDomainIs(host, "*.example.com")')
     assert parser.find_proxy_for_url('/', 'www.example.com') == 'DIRECT'
Beispiel #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"
Beispiel #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'
Beispiel #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"
Beispiel #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'
Beispiel #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'
Beispiel #21
0
 def test_valid_js_function_signatures(self, pac_js):
     pac = PACFile(pac_js)
     assert pac.find_proxy_for_url('/', 'example.com') == 'DIRECT'
Beispiel #22
0
 def test_valid_js_function_signatures(self, pac_js):
     pac = PACFile(pac_js)
     assert pac.find_proxy_for_url('/', 'example.com') == 'DIRECT'
Beispiel #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"
Beispiel #24
0
 def test_dnsDomainIs(self):
     parser = PACFile(dummy_js % 'dnsDomainIs(host, "*.example.com")')
     assert parser.find_proxy_for_url('/', 'www.example.com') == 'DIRECT'
Beispiel #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"
Beispiel #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'
Beispiel #27
0
 def test_valid_js_function_signatures(self, pac_js):
     pac = PACFile(pac_js)
     assert pac.find_proxy_for_url("/", "example.com") == "DIRECT"
Beispiel #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
Beispiel #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'