mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[4.1.x] Fixed #34088 -- Fixed Sitemap.get_latest_lastmod() crash with empty items.
Bug in480191244d. Thanks Michal Čihař for the report. Backport of5eab4d1924from main
This commit is contained in:
committed by
Mariusz Felisiak
parent
84a2b2e7a7
commit
eca526eab0
@@ -507,6 +507,16 @@ class HTTPSitemapTests(SitemapTestsBase):
|
||||
self.assertXMLEqual(index_response.content.decode(), expected_content_index)
|
||||
self.assertXMLEqual(sitemap_response.content.decode(), expected_content_sitemap)
|
||||
|
||||
def test_callable_sitemod_no_items(self):
|
||||
index_response = self.client.get("/callable-lastmod-no-items/index.xml")
|
||||
self.assertNotIn("Last-Modified", index_response)
|
||||
expected_content_index = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<sitemap><loc>http://example.com/simple/sitemap-callable-lastmod.xml</loc></sitemap>
|
||||
</sitemapindex>
|
||||
"""
|
||||
self.assertXMLEqual(index_response.content.decode(), expected_content_index)
|
||||
|
||||
|
||||
# RemovedInDjango50Warning
|
||||
class DeprecatedTests(SitemapTestsBase):
|
||||
|
||||
Reference in New Issue
Block a user