diff --git a/news/49.bugfix b/news/49.bugfix new file mode 100644 index 0000000..99c8263 --- /dev/null +++ b/news/49.bugfix @@ -0,0 +1,3 @@ +Test-only fix: normalize white space when comparing output of ``comment.getText()``. +Needed to not fail with newer ``plone.outputfilters``. +[maurits] diff --git a/plone/app/discussion/tests/test_comment.py b/plone/app/discussion/tests/test_comment.py index 17bcb64..a0a0669 100644 --- a/plone/app/discussion/tests/test_comment.py +++ b/plone/app/discussion/tests/test_comment.py @@ -18,6 +18,22 @@ logger = logging.getLogger("plone.app.discussion.tests") logger.addHandler(logging.StreamHandler()) +def normalize(value): + # Strip all white spaces of every line, then join on one line. + # But try to avoid getting 'Go toFirstparagraph

Second_paragraph

", + normalize(comment1.getText()), + "

First paragraph

Second_paragraph

", ) def test_getText_escapes_HTML(self): comment1 = createObject("plone.Comment") comment1.text = "Got HTML?" self.assertEqual( - comment1.getText(), + normalize(comment1.getText()), "

<b>Got HTML?</b>

", ) @@ -172,13 +188,13 @@ class CommentTest(unittest.TestCase): comment1 = createObject("plone.Comment") comment1.text = "Umlaute sind ä, ö und ü." out = b"

Umlaute sind \xc3\xa4, \xc3\xb6 und \xc3\xbc.

" - self.assertEqual(comment1.getText(), out.decode("utf8")) + self.assertEqual(normalize(comment1.getText()), out.decode("utf8")) def test_getText_doesnt_link(self): comment1 = createObject("plone.Comment") comment1.text = "Go to http://www.plone.org" self.assertEqual( - comment1.getText(), + normalize(comment1.getText()), "

Go to http://www.plone.org

", ) @@ -187,7 +203,7 @@ class CommentTest(unittest.TestCase): comment1.text = "Go to http://www.plone.org" comment1.mime_type = "text/x-web-intelligent" self.assertEqual( - comment1.getText(), + normalize(comment1.getText()), 'Go to
http://www.plone.org', ) @@ -197,7 +213,7 @@ class CommentTest(unittest.TestCase): comment1.text = 'Go to plone.org' comment1.mime_type = "text/html" self.assertEqual( - comment1.getText(), + normalize(comment1.getText()), 'Go to plone.org', )