-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
226 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,7 @@ __pycache__/ | |
|
||
/.ruff_cache | ||
/.mypy_cache | ||
/.pytest_cache | ||
/.coverage | ||
/htmlcov | ||
/coverage.xml |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""__init__.py | ||
Note: | ||
File : __init__.py | ||
Author : ittuann <ittuann@outlook.com> | ||
License: MIT License. | ||
""" |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Code Coverage Test. | ||
Note: | ||
File : test_functions.py | ||
Author : ittuann <ittuann@outlook.com> | ||
License: MIT License. | ||
""" | ||
|
||
from scripts.constants import DNS_API_CLOUDFLARE, DNS_API_GOOGLE, GITHUB_URLS | ||
from scripts.get_ip import DNSRecord, URLIPMapping | ||
|
||
|
||
def test_dnsrecord_class(): | ||
"""Test DNSRecord class.""" | ||
record = DNSRecord(name="example.com", type=1, TTL=300, data="1.2.3.4") | ||
assert record.name == "example.com" | ||
assert record.type == 1 | ||
assert record.ttl == 300 | ||
assert record.data == "1.2.3.4" | ||
|
||
|
||
def test_urlipmapping_class(): | ||
"""Test URLIPMapping class.""" | ||
mapping = URLIPMapping(url="example.com", ip="1.2.3.4") | ||
assert mapping.url == "example.com" | ||
assert mapping.ip == "1.2.3.4" | ||
assert mapping.to_dict() == {"example.com": "1.2.3.4"} | ||
assert str(mapping) == "URLIPMapping(url='example.com', ip='1.2.3.4')" | ||
|
||
|
||
def test_constants(): | ||
"""Test constants""" | ||
assert isinstance(DNS_API_GOOGLE, str) | ||
assert isinstance(DNS_API_CLOUDFLARE, str) | ||
assert isinstance(GITHUB_URLS, list) | ||
assert all(isinstance(url, str) for url in GITHUB_URLS) |