diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/syndication/tests.py | 23 |
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/' ) |
