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()
def test_get_protocol_default(self): sitemap = GenericSitemap({"queryset": None}) self.assertEqual(sitemap.get_protocol(), "http")
def test_get_protocol_passed_as_argument(self): sitemap = GenericSitemap({"queryset": None}) for protocol in ["http", "https"]: with self.subTest(protocol=protocol): self.assertEqual(sitemap.get_protocol(protocol), protocol)
def test_get_protocol_defined_in_constructor(self): for protocol in ["http", "https"]: with self.subTest(protocol=protocol): sitemap = GenericSitemap({"queryset": None}, protocol=protocol) self.assertEqual(sitemap.get_protocol(), protocol)