Kaydet (Commit) 5b2e11e5 authored tarafından Andrew Kuchev's avatar Andrew Kuchev Kaydeden (comit) Tim Graham

Refs #26015 -- Added regression test for an empty sitemap.

üst f05722a0
......@@ -232,3 +232,11 @@ class HTTPSitemapTests(SitemapTestsBase):
</urlset>
""".format(self.base_url, self.i18n_model.pk)
self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
def test_sitemap_without_entries(self):
response = self.client.get('/sitemap-without-entries/sitemap.xml')
expected_content = """<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
</urlset>"""
self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
......@@ -168,7 +168,9 @@ urlpatterns = [
url(r'^cached/index\.xml$', cache_page(1)(views.index),
{'sitemaps': simple_sitemaps, 'sitemap_url_name': 'cached_sitemap'}),
url(r'^cached/sitemap-(?P<section>.+)\.xml', cache_page(1)(views.sitemap),
{'sitemaps': simple_sitemaps}, name='cached_sitemap')
{'sitemaps': simple_sitemaps}, name='cached_sitemap'),
url(r'^sitemap-without-entries/sitemap\.xml$', views.sitemap,
{'sitemaps': {}}, name='django.contrib.sitemaps.views.sitemap'),
]
urlpatterns += i18n_patterns(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment