summaryrefslogtreecommitdiff
path: root/tests/sitemaps_tests/test_http.py
diff options
context:
space:
mode:
authorDaniel Ivanov <denatwrk@gmail.com>2022-11-04 16:43:40 +0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-11-07 06:15:54 +0100
commit5eab4d1924613a5506e517f157054b4852ae7dc2 (patch)
tree8f2c8501ddadbc310c4077c546954b829bff7ad7 /tests/sitemaps_tests/test_http.py
parent444b6da7cc229a58a2c476a52e45233001dc7073 (diff)
Fixed #34088 -- Fixed Sitemap.get_latest_lastmod() crash with empty items.
Bug in 480191244d12fefbf95854b2b117c71ffe44749a. Thanks Michal Čihař for the report.
Diffstat (limited to 'tests/sitemaps_tests/test_http.py')
-rw-r--r--tests/sitemaps_tests/test_http.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/sitemaps_tests/test_http.py b/tests/sitemaps_tests/test_http.py
index 4a269b8737..8c16f66896 100644
--- a/tests/sitemaps_tests/test_http.py
+++ b/tests/sitemaps_tests/test_http.py
@@ -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):