Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 2e9a8801d050c1e441ce4632ce8c6adb9eb51f40 1 parent e704559
Jacob Kaplan-Moss authored August 27, 2008
8  tests/regressiontests/syndication/fixtures/feeddata.json
@@ -22,5 +22,13 @@
22 22
       "title": "My third entry",
23 23
       "date": "2008-01-02 13:30:00"
24 24
     }
  25
+  },
  26
+  {
  27
+    "model": "syndication.entry",
  28
+    "pk": 4,
  29
+    "fields": {
  30
+      "title": "A & B < C > D",
  31
+      "date": "2008-01-03 13:30:00"
  32
+    }
25 33
   }
26 34
 ]
12  tests/regressiontests/syndication/tests.py
@@ -81,4 +81,14 @@ def test_complex_base_url(self):
81 81
         response = self.client.get('/syndication/feeds/complex/')
82 82
         self.assertEquals(response.status_code, 404)
83 83
 
84  
-
  84
+    def test_title_escaping(self):
  85
+        """
  86
+        Tests that titles are escaped correctly in RSS feeds.
  87
+        """
  88
+        response = self.client.get('/syndication/feeds/rss/')
  89
+        doc = minidom.parseString(response.content)
  90
+        for item in doc.getElementsByTagName('item'):
  91
+            link = item.getElementsByTagName('link')[0]
  92
+            if link.firstChild.wholeText == 'http://example.com/blog/4/':
  93
+                title = item.getElementsByTagName('title')[0]
  94
+                self.assertEquals(title.firstChild.wholeText, u'A &amp; B &lt; C &gt; D')

0 notes on commit 2e9a880

Please sign in to comment.
Something went wrong with that request. Please try again.