mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
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.
This commit is contained in:
committed by
Tim Graham
parent
104eddbdf6
commit
002a4f72c4
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user