summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-10-08 14:14:05 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-10-08 14:14:05 +0000
commited32170a0487cdf045b565cc971067504b79aaf0 (patch)
tree9af0a559eeba0a6df5ac87f199cc7e0038e4db0c /tests
parent060701a26aa931c5ebbd05905c94c5d1ada05bb3 (diff)
Fixed #13218 -- Ensure that syndicated content served over HTTPS uses https:// links by default. Thanks to schaefer for the report, and Ben Firshman for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14007 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/syndication/tests.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/regressiontests/syndication/tests.py b/tests/regressiontests/syndication/tests.py
index 7911657079..76a6c88bc1 100644
--- a/tests/regressiontests/syndication/tests.py
+++ b/tests/regressiontests/syndication/tests.py
@@ -236,6 +236,25 @@ class SyndicationFeedTest(FeedTestCase):
if link.getAttribute('rel') == 'self':
self.assertEqual(link.getAttribute('href'), 'http://example.com/customfeedurl/')
+ def test_secure_urls(self):
+ """
+ Test URLs are prefixed with https:// when feed is requested over HTTPS.
+ """
+ response = self.client.get('/syndication/rss2/', **{
+ 'wsgi.url_scheme': 'https',
+ })
+ doc = minidom.parseString(response.content)
+ chan = doc.getElementsByTagName('channel')[0]
+ self.assertEqual(
+ chan.getElementsByTagName('link')[0].firstChild.wholeText[0:5],
+ 'https'
+ )
+ atom_link = chan.getElementsByTagName('atom:link')[0]
+ self.assertEqual(atom_link.getAttribute('href')[0:5], 'https')
+ for link in doc.getElementsByTagName('link'):
+ if link.getAttribute('rel') == 'self':
+ self.assertEqual(link.getAttribute('href')[0:5], 'https')
+
def test_item_link_error(self):
"""
Test that a ImproperlyConfigured is raised if no link could be found
@@ -271,6 +290,10 @@ class SyndicationFeedTest(FeedTestCase):
'http://example.com/foo/?arg=value'
)
self.assertEqual(
+ views.add_domain('example.com', '/foo/?arg=value', True),
+ 'https://example.com/foo/?arg=value'
+ )
+ self.assertEqual(
views.add_domain('example.com', 'http://djangoproject.com/doc/'),
'http://djangoproject.com/doc/'
)