Пример #1
0
 def test_punycode_domain(self):
     self.assertEquals(domain_extract.Domain('https://github.com/h-j-13').domain_punycode, 'github.com')
     self.assertEquals(domain_extract.Domain('https://github.com/h-j-13').domain_punycode,
                       domain_extract.Domain('https://github.com/h-j-13').domain)
     self.assertEquals(domain_extract.Domain(u'google.クラウド').domain_punycode, 'google.xn--gckr3f0f')
     self.assertEquals(domain_extract.Domain('google.みんな').domain_punycode, 'google.xn--q9jyb4c')
     self.assertEquals(domain_extract.Domain(u'google.இந்தியா').domain_punycode, 'google.xn--xkc2dl3a5ee0h')
     self.assertEquals(domain_extract.Domain('google.닷넷').domain_punycode, 'google.xn--t60b56a')
     self.assertEquals(domain_extract.Domain(u'google.中国').domain_punycode, 'google.xn--fiqs8s')
     self.assertEquals(domain_extract.Domain('google.السعودية').domain_punycode, 'google.xn--mgberp4a5d4ar')
     self.assertEquals(domain_extract.Domain(u'google.онлайн').domain_punycode, 'google.xn--80asehdb')
Пример #2
0
 def test_get_WHOIS_server(self):
     tld_count = 0
     fail_count = 0
     for domain in self.test_domain_list:
         t = domain_extract.Domain(domain).tld_punycode
         s = domain_extract.Domain(domain).suffix_punycode
         if not WHOIS_server.WHOIS_server().get_WHOIS_server(s):
             if not WHOIS_server.WHOIS_server().get_WHOIS_server(t):
                 print t + "\t don't have record about WHOIS server"
                 fail_count += 1
         tld_count += 1
     if fail_count:
         print "==================================================================="
         print "(" + str(tld_count - fail_count) + " / " + str(tld_count) + ") TLD pass,",
         print " total : " + str(fail_count) + " tld or suffix can't get their WHOIS server"
         print "maybe update the WHOISpy/data/WHOIS_server_list.dat can fix it "
Пример #3
0
 def test_suffix(self):
     self.assertEquals(domain_extract.Domain('baidu.com.cn').suffix, 'com.cn')
Пример #4
0
 def test_tld(self):
     self.assertEquals(domain_extract.Domain('google.中国').tld_punycode, 'xn--fiqs8s')
Пример #5
0
 def test_url(self):
     self.assertEquals(domain_extract.Domain('https://github.com/h-j-13').domain_punycode, 'github.com')
Пример #6
0
 def test_utf8_domain(self):
     self.assertEquals(domain_extract.Domain('youtube.com').domain, 'youtube.com')
     self.assertEquals(domain_extract.Domain(u'www.google.com').domain, 'google.com')
     self.assertEquals(domain_extract.Domain(u'www.公司.hk').domain, 'www.公司.hk')
Пример #7
0
 def test_extract_domain(self):
     for domain in self.test_domain_list:
         domain_extract.Domain(domain)