Exemplo n.º 1
0
 def test_incorrect(self):
     executable = whois.executable  # get the original executable
     whois.executable = '/usr/bin/whois'
     with pytest.raises(ValueError):
         whois.query('google.com')
     whois.executable = executable  # revert back to old executable
     assert whois.executable == executable  # check
Exemplo n.º 2
0
 def test_executable_not_found(self):
     executable = whois.executable  # get the original executable
     whois.executable = '/usr/bin/nowhois'
     with pytest.raises(FileNotFoundError):
         whois.query('google.com')
     whois.executable = executable  # revert back to old executable
     assert whois.executable == executable  # check
Exemplo n.º 3
0
def _domain_query(domain: str):
    response = whois.query(domain, date_as_string=True)
    print(f"Query: {domain}")
    print(response)
    print("--" * 10)
    print("")
    return response
Exemplo n.º 4
0
 def test_nonexistant_tld(self):
     domain = "nonexistant.tld"
     result = whois.query(domain, date_as_string=True)
     assert result == lookup_results['nonexistant_tld']
Exemplo n.º 5
0
 def test_fabulous_com(self):
     domain = "fabulous.com"
     result = whois.query(domain, date_as_string=True)
     assert result["msg"] == "success"
     assert result["domain_info"]["name"].lower() == "fabulous.com"
     assert result["domain_info"] == lookup_results['fabulous_com']["domain_info"]
Exemplo n.º 6
0
 def test_google_org(self):
     domain = "google.org"
     result = whois.query(domain, date_as_string=True)
     assert result["msg"] == "success"
     assert result["domain_info"]["name"].lower() == "google.org"
     assert result["domain_info"] == lookup_results['google_org']["domain_info"]
Exemplo n.º 7
0
 def test_parsing_error(self):
     domain = "öbb.at"
     result = whois.query(domain)
     assert result["msg"] == "Err parsing"
Exemplo n.º 8
0
 def test_no_match(self):
     domain = "нарояци.com"
     result = whois.query(domain)
     assert result["msg"] == "No match"
Exemplo n.º 9
0
 def test_datetime_object(self):
     domain = "google.com"
     result = whois.query(domain)
     assert isinstance(result["domain_info"]["created_date"], datetime)
Exemplo n.º 10
0
 def test_datetime_as_string(self):
     domain = "google.com"
     result = whois.query(domain, date_as_string=True)
     assert isinstance(result["domain_info"]["created_date"], str)