SVN: CMF/branches/2.0/CMFCore/tests/ Add explicit tests for '_readFile' and '_createZODBClone'.

Tres Seaver <[email protected]>
Newsgroups gmane.comp.web.zope.cmf.cvs
Message-ID <[email protected]>
Log message for revision 70072:
  Add explicit tests for '_readFile' and '_createZODBClone'.

Changed:
  U   CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/test_props.props
  U   CMF/branches/2.0/CMFCore/tests/test_FSPropertiesObject.py

-=-
Modified: CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/test_props.props
===================================================================
--- CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/test_props.props	2006-09-08 16:57:07 UTC (rev 70071)
+++ CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/test_props.props	2006-09-08 17:20:08 UTC (rev 70072)
@@ -2,3 +2,9 @@
 
 value1:string=one
 value2:string=two
+an_int:int=42
+a_float:float=3.1415926
+a_boolean:boolean=False
+a_long:long=40000000000
+a_date:date=01/01/2001
+a_tokens:tokens=peter paul mary

Modified: CMF/branches/2.0/CMFCore/tests/test_FSPropertiesObject.py
===================================================================
--- CMF/branches/2.0/CMFCore/tests/test_FSPropertiesObject.py	2006-09-08 16:57:07 UTC (rev 70071)
+++ CMF/branches/2.0/CMFCore/tests/test_FSPropertiesObject.py	2006-09-08 17:20:08 UTC (rev 70072)
@@ -40,11 +40,41 @@
 
         return custom, fsdir, fspo
 
-    def test_customize( self ):
+    def test__readFile( self ):
+        from DateTime.DateTime import DateTime
 
         custom, fsdir, fspo = self._makeContext( 'test_props'
                                                , 'test_props.props')
 
+        self.assertEqual( fspo.getProperty( 'title' ), 'Test properties' )
+        self.assertEqual( fspo.getProperty( 'value1' ), 'one' )
+        self.assertEqual( fspo.getProperty( 'value2' ), 'two' )
+        self.assertEqual( fspo.getProperty( 'an_int' ), 42 )
+        self.assertEqual( fspo.getProperty( 'a_float' ), 3.1415926 )
+        self.assertEqual( fspo.getProperty( 'a_boolean' ), False )
+        self.assertEqual( fspo.getProperty( 'a_long' ), 40000000000 )
+        self.assertEqual( fspo.getProperty( 'a_date' )
+                        , DateTime( '01/01/2001' ) )
+        self.assertEqual( fspo.getProperty( 'a_tokens' )
+                        , [ 'peter', 'paul', 'mary' ] )
+
+    def test__createZODBClone( self ):
+
+        from OFS.Folder import Folder
+
+        custom, fsdir, fspo = self._makeContext( 'test_props'
+                                               , 'test_props.props')
+
+        target = fspo._createZODBClone()
+        self.failUnless( isinstance( target, Folder ) )
+        for prop_id in fspo.propertyIds():
+            self.assertEqual( target.getProperty( prop_id )
+                            , fspo.getProperty( prop_id ) )
+
+    def test_manage_doCustomize( self ):
+        custom, fsdir, fspo = self._makeContext( 'test_props'
+                                               , 'test_props.props')
+
         fspo.manage_doCustomize( folder_path='custom' )
 
         self.assertEqual( len( custom.objectIds() ), 1 )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.