mirror of https://github.com/django/django.git
Refs #26015 -- Added regression test for an empty sitemap.
This commit is contained in:
parent
f05722a08a
commit
5b2e11e574
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue