[CMF-checkins] CVS: CMF/CMFDefault/tests - test_Document.py:1.25
Ken Manheimer
klm@zope.com
Fri, 7 Jun 2002 18:43:04 -0400
Update of /cvs-repository/CMF/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv11582
Modified Files:
test_Document.py
Log Message:
Test restriction of the body strip (:-) to just stuff within an <html>
tag that is preceded only by whitespace, if anything. New tests:
- test_EditStripHTMLToBody affirms that the stripping function is
still effective, and
- test_EditPlainDocumentWithEmbeddedHTML affirms that the stuff gets
treated right.
=== CMF/CMFDefault/tests/test_Document.py 1.24 => 1.25 ===
from Products.CMFCore.tests.base.content import HTML_TEMPLATE
from Products.CMFCore.tests.base.content import BASIC_HTML
+from Products.CMFCore.tests.base.content import FAUX_HTML_LEADING_TEXT
from Products.CMFCore.tests.base.content import ENTITY_IN_TITLE
from Products.CMFCore.tests.base.content import BASIC_STRUCTUREDTEXT
from Products.CMFCore.tests.base.content import STX_WITH_HTML
@@ -84,6 +85,24 @@
d.PUT(self.REQUEST, self.RESPONSE)
self.assertEqual( d.Format(), 'text/html' )
self.assertEqual( d.Description(), 'Describe me' )
+
+ def test_EditStripHTMLToBody(self):
+ # bodyfind should strip away everything but the contents of the body
+ # tag.
+ self.REQUEST['BODY'] = BASIC_HTML
+ d = self.d
+ d.PUT(self.REQUEST, self.RESPONSE)
+ self.failUnless( hasattr(d, 'cooked_text') )
+ self.assertEqual( d.Format(), 'text/html' )
+ self.assertEquals(d.cooked_text, '\n <h1>Not a lot here</h1>\n ')
+
+ def test_EditPlainDocumentWithEmbeddedHTML(self):
+ d = self.d
+ d.edit('structured-text', FAUX_HTML_LEADING_TEXT)
+ fully_edited = d.cooked_text
+ d._edit(FAUX_HTML_LEADING_TEXT, 'structured-text')
+ partly_edited = d.cooked_text
+ self.assertEquals(fully_edited, partly_edited)
def test_BigHtml(self):
d = self.d