[CMF-checkins] CVS: CMF - test_document.py:1.2

Jeffrey Shell jeffrey@digicool.com
Fri, 23 Mar 2001 16:44:00 -0500 (EST)


Update of /cvs-repository/CMF/CMFDefault/tests
In directory korak:/home/jeffrey/InstanceHomes/cmf-dev/CMF/CMFDefault/tests

Modified Files:
	test_document.py 
Log Message:
Added a new case to test some different ways of initializing, also
updated test_Empty to check for one new condition that occurs now that 
Document.__init__() calls Document.edit() at the end instead of
Document._parse()



--- Updated File test_document.py in package CMF --
--- test_document.py	2001/03/22 21:30:12	1.1
+++ test_document.py	2001/03/23 21:43:59	1.2
@@ -35,12 +35,10 @@
         assert d.title == ''
         assert d.description == ''
         assert d.text == ''
-        assert d.text_format == ''
-        assert d.cooked_text == ''
+        assert d.text_format == 'structured-text'
 
     def test_BasicHtml(self):
-        d = Document('foo')
-        d.edit(text_format='', text=BASIC_HTML)
+        d = Document('foo', text=BASIC_HTML)
         assert d.Format() == 'text/html'
         assert d.title == 'Title in tag'
         assert string.find(d.text, '</body>') == -1
@@ -65,6 +63,24 @@
         assert d.Description() == 'A document by me'
         assert len(d.Contributors()) == 3
         assert string.find(d.cooked_text, '<p>') >= 0
+
+    def test_Init(self):
+        d = Document('foo', text=BASIC_STRUCTUREDTEXT)
+        assert d.Format() == 'text/plain'
+        assert d.Title() == 'My Document'
+        assert d.Description() == 'A document by me'
+        assert len(d.Contributors()) == 3
+        assert string.find(d.cooked_text, '<p>') >= 0
+
+        d = Document('foo', text=BASIC_HTML)
+        assert d.Format() == 'text/html'
+        assert d.Title() == 'Title in tag'
+        assert len(d.Contributors()) == 2
+
+        d = Document('foo', title='Foodoc')
+        assert d.text == ''
+        assert d.title == 'Foodoc'
+        assert d.Format() == 'text/plain'
 
 def test_suite():
     return unittest.makeSuite(TestCase)