Mike Orr avatar Mike Orr committed 5876450

Unittest to verify XML escaping is being done.

Comments (0)

Files changed (1)

tests/test_feedgenerator.py

     eq_(result, control)
 
 
+def test_escaping():
+    pubdate = datetime.datetime(2009, 12, 18, 23, 45, 12)
+    feed = fg.Rss201rev2Feed(
+        title=u"Poynter E-Media Tidbits",
+        link=u"http://www.poynter.org/column.asp?id=31",
+        description=u"A group weblog by the <em>sharpest</em> minds in online media & journalism.",
+        language=u"en",
+    )
+    feed.add_item(
+        title="Hello", 
+        link=u"http://www.holovaty.com/test/",
+        description="Testing.",  
+        pubdate=pubdate)
+    result = feed.writeString("utf-8")
+    control = """<?xml version="1.0" encoding="utf-8"?>\n<rss version="2.0"><channel><title>Poynter E-Media Tidbits</title><link>http://www.poynter.org/column.asp?id=31</link><description>A group weblog by the &lt;em&gt;sharpest&lt;/em&gt; minds in online media &amp; journalism.</description><language>en</language><lastBuildDate>Fri, 18 Dec 2009 23:45:12 -0000</lastBuildDate><item><title>Hello</title><link>http://www.holovaty.com/test/</link><description>Testing.</description><pubDate>Fri, 18 Dec 2009 23:45:12 -0000</pubDate></item></channel></rss>"""
+    eq_(result, control)
 def test_geo_point_feed():
     pubdate = datetime.datetime(2009, 12, 18, 23, 45, 12)
     feed = fg.GeoAtom1Feed(
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.