Plain text to HTML transformation added for comment text

svn path=/plone.app.discussion/trunk/; revision=38898
This commit is contained in:
Timo Stollenwerk
2010-08-25 09:19:28 +00:00
parent 5a379b7c4f
commit 35d7743b7a
4 changed files with 59 additions and 11 deletions
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import unittest
from datetime import datetime
@@ -106,6 +107,28 @@ class TestCommentsViewlet(PloneTestCase):
context = getattr(self.portal, 'doc1')
self.viewlet = CommentsViewlet(context, request, None, None)
def test_cook(self):
text = """First paragraph
Second paragraph"""
self.assertEquals(self.viewlet.cook(text),
"<p>First paragraph<br /> <br /> Second paragraph</p>")
def test_cook_no_html(self):
text = """<b>Got HTML?</b>"""
self.assertEquals(self.viewlet.cook(text),
"<p>&lt;b&gt;Got HTML?&lt;/b&gt;</p>")
def test_cook_with_no_ascii_characters(self):
text = """Umlaute sind ä, ö und ü."""
self.assertEquals(self.viewlet.cook(text),
"<p>Umlaute sind \xc3\xa4, \xc3\xb6 und \xc3\xbc.</p>")
def test_cook_links(self):
text = "Go to http://www.plone.org"
self.assertEquals(self.viewlet.cook(text),
"<p>Go to http://www.plone.org</p>")
def test_can_reply(self):
# Portal owner can reply
self.failUnless(self.viewlet.can_reply())