diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-12 12:34:42 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-01-17 11:49:15 +0100 |
commit | daf88e778bd39d908dca9efc3571d37adbd2ff4a (patch) | |
tree | 33728fc5bb7d392a9003ef2886b0da0a338abf60 /tests/sitemaps_tests | |
parent | 31878b4d7387835c5cec5e7fc5b473b737065a58 (diff) | |
download | django-daf88e778bd39d908dca9efc3571d37adbd2ff4a.tar.gz |
Refs #25916 -- Removed SitemapIndexItem.__str__() per deprecation timeline.
Diffstat (limited to 'tests/sitemaps_tests')
-rw-r--r-- | tests/sitemaps_tests/templates/custom_sitemap_index.xml | 5 | ||||
-rw-r--r-- | tests/sitemaps_tests/test_http.py | 44 | ||||
-rw-r--r-- | tests/sitemaps_tests/urls/http.py | 5 |
3 files changed, 1 insertions, 53 deletions
diff --git a/tests/sitemaps_tests/templates/custom_sitemap_index.xml b/tests/sitemaps_tests/templates/custom_sitemap_index.xml deleted file mode 100644 index 406c6b7606..0000000000 --- a/tests/sitemaps_tests/templates/custom_sitemap_index.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- This is a customised template --> -<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> -{% for location in sitemaps %}<sitemap><loc>{{ location }}</loc></sitemap>{% endfor %} -</sitemapindex> diff --git a/tests/sitemaps_tests/test_http.py b/tests/sitemaps_tests/test_http.py index 1a0c1c3d50..74d183a7b0 100644 --- a/tests/sitemaps_tests/test_http.py +++ b/tests/sitemaps_tests/test_http.py @@ -4,9 +4,8 @@ from datetime import date from django.contrib.sitemaps import Sitemap from django.contrib.sites.models import Site from django.core.exceptions import ImproperlyConfigured -from django.test import ignore_warnings, modify_settings, override_settings +from django.test import modify_settings, override_settings from django.utils import translation -from django.utils.deprecation import RemovedInDjango50Warning from django.utils.formats import localize from .base import SitemapTestsBase @@ -579,44 +578,3 @@ class HTTPSitemapTests(SitemapTestsBase): </sitemapindex> """ self.assertXMLEqual(index_response.content.decode(), expected_content_index) - - -# RemovedInDjango50Warning -class DeprecatedTests(SitemapTestsBase): - @override_settings( - TEMPLATES=[ - { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [os.path.join(os.path.dirname(__file__), "templates")], - } - ] - ) - def test_simple_sitemap_custom_index_warning(self): - msg = ( - "Calling `__str__` on SitemapIndexItem is deprecated, use the `location` " - "attribute instead." - ) - with self.assertRaisesMessage(RemovedInDjango50Warning, msg): - self.client.get("/simple/custom-index.xml") - - @ignore_warnings(category=RemovedInDjango50Warning) - @override_settings( - TEMPLATES=[ - { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [os.path.join(os.path.dirname(__file__), "templates")], - } - ] - ) - def test_simple_sitemap_custom_index(self): - "A simple sitemap index can be rendered with a custom template" - response = self.client.get("/simple/custom-index.xml") - expected_content = """<?xml version="1.0" encoding="UTF-8"?> - <!-- This is a customised template --> - <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> - <sitemap><loc>%s/simple/sitemap-simple.xml</loc></sitemap> - </sitemapindex> - """ % ( - self.base_url - ) - self.assertXMLEqual(response.content.decode(), expected_content) diff --git a/tests/sitemaps_tests/urls/http.py b/tests/sitemaps_tests/urls/http.py index 2b512cfd69..db549b4a38 100644 --- a/tests/sitemaps_tests/urls/http.py +++ b/tests/sitemaps_tests/urls/http.py @@ -280,11 +280,6 @@ urlpatterns = [ {"sitemaps": simple_sitemaps_not_callable}, ), path( - "simple/custom-index.xml", - views.index, - {"sitemaps": simple_sitemaps, "template_name": "custom_sitemap_index.xml"}, - ), - path( "simple/custom-lastmod-index.xml", views.index, { |