mirror of
https://github.com/django/django.git
synced 2025-11-24 04:47:12 +00:00
Fixed #25916 -- Added lastmod support to sitemap index view.
Co-authored-by: Matthew Downey <matthew.downey@webit.com.au>
This commit is contained in:
parent
2ce03a2bac
commit
480191244d
11 changed files with 295 additions and 45 deletions
|
|
@ -85,3 +85,12 @@ class GenericViewsSitemapTests(SitemapTestsBase):
|
|||
)
|
||||
with self.assertWarnsMessage(RemovedInDjango50Warning, msg):
|
||||
sitemap.get_protocol()
|
||||
|
||||
def test_generic_sitemap_index(self):
|
||||
TestModel.objects.update(lastmod=datetime(2013, 3, 13, 10, 0, 0))
|
||||
response = self.client.get('/generic-lastmod/index.xml')
|
||||
expected_content = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<sitemap><loc>http://example.com/simple/sitemap-generic.xml</loc><lastmod>2013-03-13T10:00:00</lastmod></sitemap>
|
||||
</sitemapindex>"""
|
||||
self.assertXMLEqual(response.content.decode('utf-8'), expected_content)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue