예제 #1
0
 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()
예제 #2
0
 def test_get_protocol_default(self):
     sitemap = GenericSitemap({"queryset": None})
     self.assertEqual(sitemap.get_protocol(), "http")
예제 #3
0
 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)
예제 #4
0
 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)