[CMF-checkins] CVS: CMF/CMFDefault/tests - test_Document.py:1.26.14.1

Yvo Schubbe schubbe@web.de
Fri, 14 Mar 2003 11:13:35 -0500


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

Modified Files:
      Tag: yuppie-collector140-branch
	test_Document.py 
Log Message:
- made setFormat('text/plain') not overwrite text_format if text_format is 'plain' (Collector #140)

=== CMF/CMFDefault/tests/test_Document.py 1.26 => 1.26.14.1 ===
--- CMF/CMFDefault/tests/test_Document.py:1.26	Wed Feb  5 12:51:22 2003
+++ CMF/CMFDefault/tests/test_Document.py	Fri Mar 14 11:13:35 2003
@@ -255,6 +255,32 @@
                              , text=STX_NO_HEADERS_BUT_COLON)
         self.assertEqual( d.EditableBody(), STX_NO_HEADERS_BUT_COLON )
 
+    def test_Format_methods(self):
+        d = self.d
+        d.setFormat( 'plain' )
+        self.assertEqual( d.text_format, 'plain' )
+        self.assertEqual( d.Format(), 'text/plain' )
+        d.setFormat( d.Format() )
+        self.assertEqual( d.text_format, 'plain' )
+
+        d = self.d
+        d.setFormat( 'structured-text' )
+        self.assertEqual( d.text_format, 'structured-text' )
+        self.assertEqual( d.Format(), 'text/plain' )
+        d.setFormat( d.Format() )
+        self.assertEqual( d.text_format, 'structured-text' )
+
+        d = self.d
+        d.setFormat( 'html' )
+        self.assertEqual( d.text_format, 'html' )
+        self.assertEqual( d.Format(), 'text/html' )
+        d.setFormat( d.Format() )
+        self.assertEqual( d.text_format, 'html' )
+
+        d = self.d
+        d.setFormat( 'foo' )
+        self.assertEqual( d.text_format, 'structured-text' )
+
     def test_interface(self):
         from Products.CMFCore.interfaces.Dynamic \
                 import DynamicType as IDynamicType
@@ -275,7 +301,7 @@
         # verifyClass(IMutableDublinCore, Document)
 
 
-class TestFTPGet( RequestTest ):
+class DocumentFTPGetTests(RequestTest):
 
     def testHTML( self ):
         self.REQUEST['BODY']=BASIC_HTML
@@ -351,7 +377,8 @@
         for header in simple_headers:
             self.failUnless( header in get_headers )
 
-class TestDocumentPUT(RequestTest):
+
+class DocumentPUTTests(RequestTest):
 
     def setUp(self):
         RequestTest.setUp(self)
@@ -421,8 +448,8 @@
 def test_suite():
     return TestSuite((
         makeSuite(DocumentTests),
-        makeSuite(TestFTPGet),
-        makeSuite(TestDocumentPUT),
+        makeSuite(DocumentFTPGetTests),
+        makeSuite(DocumentPUTTests),
         ))
 
 if __name__ == '__main__':