[CMF-checkins] CVS: CMF/CMFDefault/tests - test_utils.py:1.8.6.1

Yvo Schubbe schubbe@web.de
Fri, 21 Feb 2003 10:45:17 -0500


Update of /cvs-repository/CMF/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv32372/CMFDefault/tests

Modified Files:
      Tag: yuppie-collector108-branch
	test_utils.py 
Log Message:
- made StrippingParser closing empty tags (Collector #108)
- added scrubHTML test

=== CMF/CMFDefault/tests/test_utils.py 1.8 => 1.8.6.1 ===
--- CMF/CMFDefault/tests/test_utils.py:1.8	Wed Feb  5 12:51:22 2003
+++ CMF/CMFDefault/tests/test_utils.py	Fri Feb 21 10:44:46 2003
@@ -7,10 +7,13 @@
 from Products.CMFCore.tests.base.content import SIMPLE_XHTML
 from Products.CMFCore.tests.base.content import STX_WITH_HTML
 
-from Products.CMFDefault.utils import parseHeadersBody, tuplize, comma_split
 from Products.CMFDefault.utils import bodyfinder
+from Products.CMFDefault.utils import comma_split
 from Products.CMFDefault.utils import html_headcheck
+from Products.CMFDefault.utils import parseHeadersBody
+from Products.CMFDefault.utils import scrubHTML
 from Products.CMFDefault.utils import seq_strip
+from Products.CMFDefault.utils import tuplize
 
 
 class DefaultUtilsTests(TestCase):
@@ -67,6 +70,26 @@
         assert( len( headers ) == 3, '%d!' % len( headers ) )
         assert( preloaded[ 'Author' ] != headers[ 'Author' ] )
         assert( preloaded[ 'text_format' ] == headers[ 'text_format' ] )
+
+    def test_scrubHTML(self):
+        self.assertEqual( scrubHTML('<a href="foo.html">bar</a>'),
+                          '<a href="foo.html">bar</a>' )
+        self.assertEqual( scrubHTML('<b>bar</b>'),
+                          '<b>bar</b>' )
+        self.assertEqual( scrubHTML('<base href="" /><base>'),
+                          '<base href="" /><base />' )
+        self.assertEqual( scrubHTML('<blockquote>bar</blockquote>'),
+                          '<blockquote>bar</blockquote>' )
+        self.assertEqual( scrubHTML('<body bgcolor="#ffffff">bar</body>'),
+                          '<body bgcolor="#ffffff">bar</body>' )
+        self.assertEqual( scrubHTML('<br /><br>'),
+                          '<br /><br />' )
+        self.assertEqual( scrubHTML('<hr /><hr>'),
+                          '<hr /><hr />' )
+        self.assertEqual( scrubHTML('<img src="foo.png" /><img>'),
+                          '<img src="foo.png" /><img />' )
+        self.assertEqual( scrubHTML('<meta name="title" content="" /><meta>'),
+                          '<meta name="title" content="" /><meta />' )
 
     def test_bodyfinder(self):
         self.assertEqual( bodyfinder(FAUX_HTML_LEADING_TEXT),