@@ -0,0 +1,13 @@
|
||||
from apps.sources.services.canonicalize import canonicalize_url, domain_matches
|
||||
|
||||
|
||||
def test_canonicalize_url_removes_tracking_and_fragment():
|
||||
value = canonicalize_url(
|
||||
"HTTPS://Jobs.Example.org:443/jobs/../jobs/42/?utm_source=mail&b=2&a=1#apply"
|
||||
)
|
||||
assert value == "https://jobs.example.org/jobs/42/?a=1&b=2"
|
||||
|
||||
|
||||
def test_domain_matches_subdomains_but_not_suffix_attack():
|
||||
assert domain_matches("www.linkedin.com", "linkedin.com")
|
||||
assert not domain_matches("linkedin.com.evil.example", "linkedin.com")
|
||||
Reference in New Issue
Block a user