mirror of
https://github.com/MayersScott/rkn-block-checker.git
synced 2026-06-28 20:01:24 +00:00
35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
from rkn_checker.http import looks_like_stub
|
|
|
|
|
|
class TestLooksLikeStub:
|
|
def test_empty_body_is_not_stub(self):
|
|
assert looks_like_stub("") is False
|
|
|
|
def test_normal_page_is_not_stub(self):
|
|
body = "<html><body>welcome to our online store</body></html>"
|
|
assert looks_like_stub(body) is False
|
|
|
|
def test_detects_access_restricted_phrase(self):
|
|
body = "<html><body>доступ ограничен по решению суда</body></html>"
|
|
assert looks_like_stub(body) is True
|
|
|
|
def test_detects_blocked_phrase(self):
|
|
body = "сайт заблокирован"
|
|
assert looks_like_stub(body) is True
|
|
|
|
def test_detects_english_blocked_by(self):
|
|
body = "this resource is blocked by your provider"
|
|
assert looks_like_stub(body) is True
|
|
|
|
def test_detects_rkn_link(self):
|
|
body = "for more information visit rkn.gov.ru"
|
|
assert looks_like_stub(body) is True
|
|
|
|
def test_detects_unified_registry_phrase(self):
|
|
body = "сайт включён в единый реестр запрещённых ресурсов"
|
|
assert looks_like_stub(body) is True
|
|
|
|
def test_caller_must_lowercase_body(self):
|
|
# The matcher does a plain substring scan — uppercase shouldn't match.
|
|
body = "ДОСТУП ОГРАНИЧЕН"
|
|
assert looks_like_stub(body) is False
|