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
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
def _domain_query(domain: str): response = whois.query(domain, date_as_string=True) print(f"Query: {domain}") print(response) print("--" * 10) print("") return response
def test_nonexistant_tld(self): domain = "nonexistant.tld" result = whois.query(domain, date_as_string=True) assert result == lookup_results['nonexistant_tld']
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"]
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"]
def test_parsing_error(self): domain = "öbb.at" result = whois.query(domain) assert result["msg"] == "Err parsing"
def test_no_match(self): domain = "нарояци.com" result = whois.query(domain) assert result["msg"] == "No match"
def test_datetime_object(self): domain = "google.com" result = whois.query(domain) assert isinstance(result["domain_info"]["created_date"], datetime)
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)