Skip to content

Commit

Permalink
Fix tests issue
Browse files Browse the repository at this point in the history
  • Loading branch information
funilrys committed Mar 17, 2024
1 parent c2b51e2 commit d7c5835
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion PyFunceble/downloader/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@

import PyFunceble.downloader.exceptions
import PyFunceble.exceptions
import PyFunceble.factory
import PyFunceble.storage
from PyFunceble.helpers.dict import DictHelper
from PyFunceble.helpers.download import DownloadHelper
Expand Down Expand Up @@ -271,6 +270,7 @@ def is_last_download_expired(self) -> bool:

return False


def start(self) -> None:
"""
Starts the download process.
Expand Down
12 changes: 6 additions & 6 deletions PyFunceble/query/dns/nameserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
import dns.exception
import dns.resolver

from PyFunceble.checker.syntax.ip import IPSyntaxChecker
import PyFunceble.facility
import PyFunceble.storage
from PyFunceble.checker.syntax.domain import DomainSyntaxChecker
from PyFunceble.converter.url2netloc import Url2Netloc


Expand All @@ -78,13 +78,13 @@ class Nameservers:

protocol: Optional[str] = None

domain_syntax_checker: Optional[DomainSyntaxChecker] = None
ip_syntax_checker: Optional[IPSyntaxChecker] = None
url2netloc: Url2Netloc = Url2Netloc()

def __init__(
self, nameserver: Optional[List[str]] = None, protocol: str = "TCP"
) -> None:
self.domain_syntax_checker = DomainSyntaxChecker()
self.ip_syntax_checker = IPSyntaxChecker()
self.protocol = protocol

if nameserver is not None:
Expand Down Expand Up @@ -139,7 +139,9 @@ def get_ip_from_nameserver(self, nameserver: str) -> List[str]:

result = []

if self.domain_syntax_checker.set_subject(nameserver).is_valid():
if self.ip_syntax_checker.set_subject(nameserver).is_valid():
result.append(nameserver)
else:
try:
result.extend(
[
Expand All @@ -159,8 +161,6 @@ def get_ip_from_nameserver(self, nameserver: str) -> List[str]:
)
except dns.exception.DNSException:
pass
else:
result.append(nameserver)

PyFunceble.facility.Logger.debug(
"IP from nameserver (%r):\n%r", nameserver, result
Expand Down
2 changes: 1 addition & 1 deletion tests/query/dnss/test_nameserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def test_get_ip_from_nameserver_not_valid_domain(self) -> None:

given = "example.funilrys"

expected = ["example.funilrys"]
expected = []
actual = self.nameserver_provider.get_ip_from_nameserver(given)

self.assertEqual(expected, actual)
Expand Down

0 comments on commit d7c5835

Please sign in to comment.