mwmbl/test/test_update_urls.py
2023-10-10 20:18:43 +01:00

43 lines
1.2 KiB
Python

from mwmbl.indexer.update_urls import process_link
def test_process_link_normal():
url_scores = {"https://somesite.com/something.html": 0.0, "https://somesite.com/": 0.0}
url_timestamps = {}
url_users = {}
process_link(
user_id_hash="abc123",
crawled_page_domain="somewhere.com",
link="https://somesite.com/something.html",
unknown_domain_multiplier=1,
timestamp=1234,
url_scores=url_scores,
url_timestamps=url_timestamps,
url_users=url_users,
is_extra=False, blacklist_domains=[]
)
assert url_scores["https://somesite.com/something.html"] > 0.0
def test_process_link_excludes_porn():
url_scores = {}
url_timestamps = {}
url_users = {}
process_link(
user_id_hash="abc123",
crawled_page_domain="somewhere.com",
link="https://somepornsite.com/something.html",
unknown_domain_multiplier=1,
timestamp=1234,
url_scores=url_scores,
url_timestamps=url_timestamps,
url_users=url_users,
is_extra=False, blacklist_domains=[]
)
assert url_scores == {}
assert url_timestamps == {}
assert url_users == {}