mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Refs #32375 -- Changed default sitemap protocol to https.
Per deprecation timeline.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
from datetime import datetime
|
||||
|
||||
from django.contrib.sitemaps import GenericSitemap
|
||||
from django.test import ignore_warnings, override_settings
|
||||
from django.utils.deprecation import RemovedInDjango50Warning
|
||||
from django.test import override_settings
|
||||
|
||||
from .base import SitemapTestsBase
|
||||
from .models import TestModel
|
||||
@@ -79,20 +78,9 @@ class GenericViewsSitemapTests(SitemapTestsBase):
|
||||
with self.subTest(protocol=protocol):
|
||||
self.assertEqual(sitemap.get_protocol(protocol), protocol)
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango50Warning)
|
||||
def test_get_protocol_default(self):
|
||||
sitemap = GenericSitemap({"queryset": None})
|
||||
self.assertEqual(sitemap.get_protocol(), "http")
|
||||
|
||||
def test_get_protocol_default_warning(self):
|
||||
sitemap = GenericSitemap({"queryset": None})
|
||||
msg = (
|
||||
"The default sitemap protocol will be changed from 'http' to "
|
||||
"'https' in Django 5.0. Set Sitemap.protocol to silence this "
|
||||
"warning."
|
||||
)
|
||||
with self.assertWarnsMessage(RemovedInDjango50Warning, msg):
|
||||
sitemap.get_protocol()
|
||||
self.assertEqual(sitemap.get_protocol(), "https")
|
||||
|
||||
def test_generic_sitemap_index(self):
|
||||
TestModel.objects.update(lastmod=datetime(2013, 3, 13, 10, 0, 0))
|
||||
|
||||
Reference in New Issue
Block a user