1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[3.2.x] Fixed #32648 -- Fixed VariableDoesNotExist rendering sitemaps template.

Backport of 08c60cce3b from main
This commit is contained in:
Arthur Jovart
2021-04-14 14:50:01 +02:00
committed by Carlton Gibson
parent 59cce8237c
commit 65dfb06a1a
4 changed files with 12 additions and 6 deletions

View File

@@ -255,9 +255,12 @@ class HTTPSitemapTests(SitemapTestsBase):
@override_settings(LANGUAGES=(('en', 'English'), ('pt', 'Portuguese')))
def test_simple_i18n_sitemap_index(self):
"""
A simple i18n sitemap index can be rendered.
A simple i18n sitemap index can be rendered, without logging variable
lookup errors.
"""
response = self.client.get('/simple/i18n.xml')
with self.assertRaisesMessage(AssertionError, 'no logs'):
with self.assertLogs('django.template', 'DEBUG'):
response = self.client.get('/simple/i18n.xml')
expected_content = """<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url><loc>{0}/en/i18n/testmodel/{1}/</loc><changefreq>never</changefreq><priority>0.5</priority></url><url><loc>{0}/pt/i18n/testmodel/{1}/</loc><changefreq>never</changefreq><priority>0.5</priority></url>