summaryrefslogtreecommitdiff
path: root/tests/sitemaps_tests
diff options
context:
space:
mode:
authorRohith PR <praroh2@gmail.com>2021-05-21 10:51:17 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-05-21 10:55:05 +0200
commit56003b21eae3813e93fdd74f2b206d91e566bb27 (patch)
tree95e30b0991932f64ba717656a96710b4170dd0cb /tests/sitemaps_tests
parente197dcca366cf0b7203123e4ba7f8962e1d69e72 (diff)
downloaddjango-56003b21eae3813e93fdd74f2b206d91e566bb27.tar.gz
Added tests for Sitemap.get_protocol().
Diffstat (limited to 'tests/sitemaps_tests')
-rw-r--r--tests/sitemaps_tests/test_generic.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/sitemaps_tests/test_generic.py b/tests/sitemaps_tests/test_generic.py
index b1ec2fed35..ba24773b9e 100644
--- a/tests/sitemaps_tests/test_generic.py
+++ b/tests/sitemaps_tests/test_generic.py
@@ -57,3 +57,19 @@ class GenericViewsSitemapTests(SitemapTestsBase):
""" % (self.base_url, test_model.pk)
self.assertXMLEqual(response.content.decode(), expected_content)
self.assertEqual(response.headers['Last-Modified'], 'Wed, 13 Mar 2013 10:00:00 GMT')
+
+ 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)
+
+ 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_default(self):
+ sitemap = GenericSitemap({'queryset': None})
+ self.assertEqual(sitemap.get_protocol(), 'http')