Test loading a sitemap with CDATA sections.
(server_url: URL, http_client: HttpClient)
| 222 | |
| 223 | |
| 224 | async def test_cdata_sitemap(server_url: URL, http_client: HttpClient) -> None: |
| 225 | """Test loading a sitemap with CDATA sections.""" |
| 226 | cdata_sitemap = f""" |
| 227 | <?xml version="1.0" encoding="UTF-8"?> |
| 228 | <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
| 229 | <url> |
| 230 | <loc><![CDATA[{server_url}catalog]]></loc> |
| 231 | </url> |
| 232 | </urlset> |
| 233 | """.strip() |
| 234 | sitemap_url = (server_url / 'sitemap.xml').with_query( |
| 235 | base64=encode_base64(cdata_sitemap.encode()), c_type='application/xml; charset=utf-8' |
| 236 | ) |
| 237 | sitemap = await Sitemap.load(str(sitemap_url), http_client=http_client) |
| 238 | |
| 239 | assert len(sitemap.urls) == 1 |
| 240 | assert sitemap.urls == [f'{server_url}catalog'] |
| 241 | |
| 242 | |
| 243 | async def test_txt_sitemap(server_url: URL, http_client: HttpClient) -> None: |
nothing calls this directly
no test coverage detected