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
This commit is contained in:
parent
e704559e56
commit
2e9a8801d0
|
@ -22,5 +22,13 @@
|
||||||
"title": "My third entry",
|
"title": "My third entry",
|
||||||
"date": "2008-01-02 13:30:00"
|
"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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
|
@ -81,4 +81,14 @@ class SyndicationFeedTest(TestCase):
|
||||||
response = self.client.get('/syndication/feeds/complex/')
|
response = self.client.get('/syndication/feeds/complex/')
|
||||||
self.assertEquals(response.status_code, 404)
|
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 & B < C > D')
|
Loading…
Reference in New Issue