Merge pull request #6232 from elramen/linkextractor_tests

Added tests for LxmlLinkExtractor
This commit is contained in:
Andrey Rakhmatullin 2024-02-21 23:03:20 +05:00 committed by GitHub
commit f798118ac2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions

View File

@ -851,3 +851,15 @@ class LxmlLinkExtractorTestCase(Base.LinkExtractorTestCase):
),
],
)
def test_link_allowed_is_false_with_empty_url(self):
bad_link = Link("")
self.assertFalse(LxmlLinkExtractor()._link_allowed(bad_link))
def test_link_allowed_is_false_with_bad_url_prefix(self):
bad_link = Link("htp://should_be_http.example")
self.assertFalse(LxmlLinkExtractor()._link_allowed(bad_link))
def test_link_allowed_is_false_with_missing_url_prefix(self):
bad_link = Link("should_have_prefix.example")
self.assertFalse(LxmlLinkExtractor()._link_allowed(bad_link))