summaryrefslogtreecommitdiff
path: root/tests/sitemaps_tests/test_http.py
diff options
context:
space:
mode:
authorAlexander Rudakov <piercemind@gmail.com>2015-12-26 21:01:25 +0300
committerTim Graham <timograham@gmail.com>2016-01-23 08:48:31 -0500
commit002a4f72c46458514d97f7e54d4fd9416d89899d (patch)
treec95c3b0bbe1a77761ae8f4159d4af3adf783808d /tests/sitemaps_tests/test_http.py
parent104eddbdf6c31984b5afbdf5477267570de6d0f4 (diff)
Fixed #25989 -- Corrected sitemap's Last-Modified header to use the latest lastmod of all sitemaps.
Previously, the lastmod of the last sitemap was always used. All sitemaps are required to have a lastmod.
Diffstat (limited to 'tests/sitemaps_tests/test_http.py')
-rw-r--r--tests/sitemaps_tests/test_http.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/sitemaps_tests/test_http.py b/tests/sitemaps_tests/test_http.py
index 399cd35ae6..38a79a03f2 100644
--- a/tests/sitemaps_tests/test_http.py
+++ b/tests/sitemaps_tests/test_http.py
@@ -110,6 +110,38 @@ class HTTPSitemapTests(SitemapTestsBase):
response = self.client.get('/lastmod-mixed/sitemap.xml')
self.assertFalse(response.has_header('Last-Modified'))
+ def test_sitemaps_lastmod_mixed_ascending_last_modified_missing(self):
+ """
+ The Last-Modified header is omitted when lastmod isn't found in all
+ sitemaps. Test sitemaps are sorted by lastmod in ascending order.
+ """
+ response = self.client.get('/lastmod-sitemaps/mixed-ascending.xml')
+ self.assertFalse(response.has_header('Last-Modified'))
+
+ def test_sitemaps_lastmod_mixed_descending_last_modified_missing(self):
+ """
+ The Last-Modified header is omitted when lastmod isn't found in all
+ sitemaps. Test sitemaps are sorted by lastmod in descending order.
+ """
+ response = self.client.get('/lastmod-sitemaps/mixed-descending.xml')
+ self.assertFalse(response.has_header('Last-Modified'))
+
+ def test_sitemaps_lastmod_ascending(self):
+ """
+ The Last-Modified header is set to the most recent sitemap lastmod.
+ Test sitemaps are sorted by lastmod in ascending order.
+ """
+ response = self.client.get('/lastmod-sitemaps/ascending.xml')
+ self.assertEqual(response['Last-Modified'], 'Sat, 20 Apr 2013 05:00:00 GMT')
+
+ def test_sitemaps_lastmod_descending(self):
+ """
+ The Last-Modified header is set to the most recent sitemap lastmod.
+ Test sitemaps are sorted by lastmod in descending order.
+ """
+ response = self.client.get('/lastmod-sitemaps/descending.xml')
+ self.assertEqual(response['Last-Modified'], 'Sat, 20 Apr 2013 05:00:00 GMT')
+
@skipUnless(settings.USE_I18N, "Internationalization is not enabled")
@override_settings(USE_L10N=True)
def test_localized_priority(self):