MCPcopy Create free account
hub / github.com/apify/crawlee-python / test_sitemap_different_url

Function test_sitemap_different_url

tests/unit/_utils/test_sitemap.py:90–98  ·  view source on GitHub ↗

Test loading a basic sitemap when sitemap contains links to different url. Those should be ignored.

(server_url: URL, http_client: HttpClient)

Source from the content-addressed store, hash-verified

88
89
90async def test_sitemap_different_url(server_url: URL, http_client: HttpClient) -> None:
91 """Test loading a basic sitemap when sitemap contains links to different url. Those should be ignored."""
92 different_url = 'https://other.com/'
93 sitemap_url = (server_url / 'sitemap.xml').with_query(
94 base64=encode_base64(get_basic_sitemap(url=different_url).encode()), c_type='application/xml; charset=utf-8'
95 )
96 sitemap = await Sitemap.load(str(sitemap_url), http_client=http_client)
97
98 assert len(sitemap.urls) == 0
99
100
101async def test_sitemap_different_url_allowed(server_url: URL, http_client: HttpClient) -> None:

Callers

nothing calls this directly

Calls 3

get_basic_sitemapFunction · 0.90
encode_base64Function · 0.70
loadMethod · 0.45

Tested by

no test coverage detected