diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-08 14:17:13 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-08 14:17:13 +0000 |
| commit | 0d4d924ca5cae8aadb5f5973fe4b26c9c7fc7a0f (patch) | |
| tree | 37278f55da848bc1604eb311469e3d13127f8157 /tests | |
| parent | 36167517aa6e08cfcaf1ed7c8fb8cb1dd53938d8 (diff) | |
[1.2.X] 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.
Backport of r14007 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14010 bcc190cf-cafb-0310-a4f2-bffc1f526a37
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/' ) |
