From 5b2e11e574dcc84d3d10efa3ee45c25f97faca5e Mon Sep 17 00:00:00 2001
From: Andrew Kuchev <0coming.soon@gmail.com>
Date: Mon, 25 Jan 2016 00:35:46 +0500
Subject: [PATCH] Refs #26015 -- Added regression test for an empty sitemap.
---
tests/sitemaps_tests/test_http.py | 8 ++++++++
tests/sitemaps_tests/urls/http.py | 4 +++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/tests/sitemaps_tests/test_http.py b/tests/sitemaps_tests/test_http.py
index 38a79a03f2c..5b3cbb58438 100644
--- a/tests/sitemaps_tests/test_http.py
+++ b/tests/sitemaps_tests/test_http.py
@@ -232,3 +232,11 @@ class HTTPSitemapTests(SitemapTestsBase):
""".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 = """
+
+
+"""
+ self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
diff --git a/tests/sitemaps_tests/urls/http.py b/tests/sitemaps_tests/urls/http.py
index fcc5964d7ac..6a6269be96d 100644
--- a/tests/sitemaps_tests/urls/http.py
+++ b/tests/sitemaps_tests/urls/http.py
@@ -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.+)\.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(