-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from riotkit-org/issue_15
#15: Fix support for .sk domains, tested on priamaakcia.sk
- Loading branch information
Showing
3 changed files
with
120 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import inspect | ||
import unittest.mock | ||
import datetime | ||
import whois | ||
|
||
path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + '/../infracheck/checks/' | ||
DomainCheck: any | ||
|
@@ -47,3 +48,61 @@ def test_expired(self): | |
|
||
self.assertIn("Domain google.com expired", result[1]) | ||
self.assertFalse(result[0]) | ||
|
||
def test_sk_domain_manual_whois_parsing(self): | ||
check = DomainCheck('priamaakcia.sk', 25) | ||
|
||
def mock_library_raises_exception(*args, **kwargs): | ||
raise whois.exceptions.UnknownTld() | ||
|
||
check._ask_whois_library = mock_library_raises_exception | ||
check._ask_whois_in_shell = lambda *args, **kwargs: """ | ||
Domain: priamaakcia.sk | ||
Registrant: WEBHOUSE-AZPNWEY | ||
Admin Contact: WEBHOUSE | ||
Tech Contact: WEBHOUSE | ||
Registrar: IPEK-0001 | ||
Created: 2005-06-24 | ||
Updated: 2020-07-08 | ||
Valid Until: 2999-06-24 | ||
Nameserver: ns1.afraid.org | ||
Nameserver: ns2.afraid.org | ||
EPP Status: ok | ||
Registrar: IPEK-0001 | ||
Name: WebHouse, s.r.o. | ||
Organization: WebHouse, s.r.o. | ||
Organization ID: 36743852 | ||
Phone: +421.332933500 | ||
Email: [email protected] | ||
Street: Paulínska 20 | ||
City: Trnava | ||
Postal Code: 91701 | ||
Country Code: SK | ||
Created: 2017-09-01 | ||
Updated: 2021-05-17 | ||
Contact: WEBHOUSE-AZPNWEY | ||
Registrar: IPEK-0001 | ||
Created: 2017-09-02 | ||
Updated: 2017-11-01 | ||
Contact: WEBHOUSE | ||
Name: WebHouse, s. r. o. | ||
Organization: WebHouse, s. r. o. | ||
Organization ID: 36743852 | ||
Phone: +421.910969601 | ||
Email: [email protected] | ||
Street: Paulínska 20 | ||
City: Trnava | ||
Postal Code: 917 01 | ||
Country Code: SK | ||
Registrar: IPEK-0001 | ||
Created: 2017-09-02 | ||
Updated: 2021-03-22 | ||
""" | ||
|
||
result = check.perform_check() | ||
|
||
self.assertIn('Domain priamaakcia.sk is not expired.', result[1]) | ||
self.assertTrue(result[0]) |