changeset 1200:302e1a86f494

Add unit test for _render_data_diff
author Shitiz Garg <mail@dragooon.net>
date Wed, 04 Jan 2012 06:06:35 +0530
parents a4ce283b0ca2
children 526c97231401
files MoinMoin/items/_tests/test_Item.py
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/_tests/test_Item.py	Wed Jan 04 03:52:32 2012 +0530
+++ b/MoinMoin/items/_tests/test_Item.py	Wed Jan 04 06:06:35 2012 +0530
@@ -455,6 +455,23 @@
         expected = test_text
         assert result == expected
 
+    def test__render_data_diff(self):
+        # Test for HTML render with Unicode text
+        item_name = u'Html_Item'
+        item = Text.create(item_name)
+        contenttype = u'text/html;charset=utf-8'
+        meta = {CONTENTTYPE: contenttype}
+        item._save(meta, u'<span></span>')
+        item1 = Text.create(item_name)
+        data = u'<span>한국어</span>'
+        comment = u'next revision'
+        item1._save(meta, data, comment=comment)
+        item2 = Text.create(item_name)
+        result = Text._render_data_diff(item1, item1.rev, item2.rev)
+        expected = u'<span>한국어</span>'
+        assert expected in result
+        assert item2.data == ''
+
     def test__render_data_diff_text(self):
         item_name = u'Text_Item'
         item = Text.create(item_name)