File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ class TargetType(str, Enum):
2222
2323
2424def hostname_from_url (url : Union [HttpUrl , str ]) -> Hostname :
25- return Hostname (urlparse (url ).netloc )
25+ parsed = urlparse (url )
26+ if all ([parsed .scheme , parsed .netloc ]) is True :
27+ url = parsed .netloc
28+
29+ return Hostname (url )
2630
2731
2832class DomainValidator :
Original file line number Diff line number Diff line change 55
66from aleph .sdk .domain import DomainValidator
77from aleph .sdk .exceptions import DomainConfigurationError
8-
98from src .aleph .sdk .domain import TargetType , hostname_from_url
109
1110
11+ def test_hostname ():
12+ hostname = hostname_from_url ("https://aleph.im" )
13+ assert hostname == "aleph.im"
14+ hostname = hostname_from_url ("aleph.im" )
15+ assert hostname == "aleph.im"
16+
1217@pytest .mark .asyncio
1318async def test_query ():
1419 alephdns = DomainValidator ()
@@ -55,3 +60,4 @@ async def test_not_configured_domain():
5560 hostname = hostname_from_url (url )
5661 with pytest .raises (DomainConfigurationError ):
5762 status = await alephdns .check_domain (hostname , TargetType .IPFS , "0xfakeaddress" )
63+ assert type (status ) is None
You can’t perform that action at this time.
0 commit comments