summaryrefslogtreecommitdiff
path: root/tests/regressiontests/syndication
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2008-08-27 19:52:27 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2008-08-27 19:52:27 +0000
commit2e9a8801d050c1e441ce4632ce8c6adb9eb51f40 (patch)
treeacd2b5965e113ab7d260e46535fb0b2e50b4391c /tests/regressiontests/syndication
parente704559e567c46d46fe9268147e1a4a2cf83f4a2 (diff)
Added a test to ensure that strings in RSS are properly escaped. Refs #6533.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8632 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/syndication')
-rw-r--r--tests/regressiontests/syndication/fixtures/feeddata.json8
-rw-r--r--tests/regressiontests/syndication/tests.py12
2 files changed, 19 insertions, 1 deletions
diff --git a/tests/regressiontests/syndication/fixtures/feeddata.json b/tests/regressiontests/syndication/fixtures/feeddata.json
index de752f66bf..375ee16c41 100644
--- a/tests/regressiontests/syndication/fixtures/feeddata.json
+++ b/tests/regressiontests/syndication/fixtures/feeddata.json
@@ -22,5 +22,13 @@
"title": "My third entry",
"date": "2008-01-02 13:30:00"
}
+ },
+ {
+ "model": "syndication.entry",
+ "pk": 4,
+ "fields": {
+ "title": "A & B < C > D",
+ "date": "2008-01-03 13:30:00"
+ }
}
] \ No newline at end of file
diff --git a/tests/regressiontests/syndication/tests.py b/tests/regressiontests/syndication/tests.py
index caf5e4f04d..1410ed7517 100644
--- a/tests/regressiontests/syndication/tests.py
+++ b/tests/regressiontests/syndication/tests.py
@@ -81,4 +81,14 @@ class SyndicationFeedTest(TestCase):
response = self.client.get('/syndication/feeds/complex/')
self.assertEquals(response.status_code, 404)
-
+ def test_title_escaping(self):
+ """
+ Tests that titles are escaped correctly in RSS feeds.
+ """
+ response = self.client.get('/syndication/feeds/rss/')
+ doc = minidom.parseString(response.content)
+ for item in doc.getElementsByTagName('item'):
+ link = item.getElementsByTagName('link')[0]
+ if link.firstChild.wholeText == 'http://example.com/blog/4/':
+ title = item.getElementsByTagName('title')[0]
+ self.assertEquals(title.firstChild.wholeText, u'A &amp; B &lt; C &gt; D') \ No newline at end of file