app.bettersight.io/backend/tests/services/test_url_utils.py

20 lines
642 B
Python

from services.url_utils import is_generic_homepage
def test_bare_root_domain_is_generic():
assert is_generic_homepage('https://www.explore.co.uk/') is True
assert is_generic_homepage('https://www.explore.co.uk') is True
def test_root_domain_with_query_string_is_generic():
assert is_generic_homepage('https://www.explore.co.uk/?ref=homepage') is True
def test_trip_specific_path_is_not_generic():
assert is_generic_homepage('https://www.explore.co.uk/peru-classic-15-days') is False
def test_none_or_empty_url_is_not_generic():
assert is_generic_homepage(None) is False
assert is_generic_homepage('') is False