[CMF-checkins] CVS: CMF/CMFSetup/tests - test_context.py:1.9

Tres Seaver tseaver at zope.com
Tue Jul 20 12:14:23 EDT 2004


Update of /cvs-repository/CMF/CMFSetup/tests
In directory cvs.zope.org:/tmp/cvs-serv27771/tests

Modified Files:
	test_context.py 
Log Message:


  - interfaces.py:

    o Modify API for 'compareConfigurations', which should now be passed
      IimportContext implementations for lhs / rhs arguments.

  - context.py:

    o Rename ImportContext -> DirectoryImportContext.

    o Rename ExportContext -> ExrectoryImportContext.

    o Fix glitch in DirectoryImportContext which broke 'listDirectory'
      for the profile root.

    o Use 'read()' instead of 'manage_FTPget' to fetch content for objects
      in SnapshotImportContexts;  note that this may not be general enough
      for all cases (but it should work for PythonScripts, and *does* work
      for PageTemplates).

  - tool/py:

    o Add UI for displaying / downloading diffs of configurations (profiles
      and snapshots).


=== CMF/CMFSetup/tests/test_context.py 1.8 => 1.9 ===
--- CMF/CMFSetup/tests/test_context.py:1.8	Mon Jul 19 14:04:18 2004
+++ CMF/CMFSetup/tests/test_context.py	Tue Jul 20 12:13:52 2004
@@ -31,17 +31,17 @@
 
     pass
 
-class ImportContextTests( FilesystemTestBase
-                        , ConformsToISetupContext
-                        , ConformsToIImportContext
-                        ):
+class DirectoryImportContextTests( FilesystemTestBase
+                                 , ConformsToISetupContext
+                                 , ConformsToIImportContext
+                                 ):
 
     _PROFILE_PATH = '/tmp/ICTTexts'
 
     def _getTargetClass( self ):
 
-        from Products.CMFSetup.context import ImportContext
-        return ImportContext
+        from Products.CMFSetup.context import DirectoryImportContext
+        return DirectoryImportContext
 
     def test_readDataFile_nonesuch( self ):
 
@@ -183,6 +183,19 @@
 
         self.assertEqual( ctx.listDirectory( FILENAME ), None )
 
+    def test_listDirectory_root( self ):
+
+        from string import printable
+
+        site = DummySite( 'site' ).__of__( self.root )
+        ctx = self._makeOne( site, self._PROFILE_PATH )
+
+        FILENAME = 'simple.txt'
+        self._makeFile( FILENAME, printable )
+
+        self.assertEqual( len( ctx.listDirectory( None ) ), 1 )
+        self.failUnless( FILENAME in ctx.listDirectory( None ) )
+
     def test_listDirectory_simple( self ):
 
         from string import printable
@@ -276,17 +289,17 @@
         self.failUnless( 'CVS' in names )
 
 
-class ExportContextTests( FilesystemTestBase
-                        , ConformsToISetupContext
-                        , ConformsToIExportContext
-                        ):
+class DirectoryExportContextTests( FilesystemTestBase
+                                 , ConformsToISetupContext
+                                 , ConformsToIExportContext
+                                 ):
 
     _PROFILE_PATH = '/tmp/ECTTexts'
 
     def _getTargetClass( self ):
 
-        from Products.CMFSetup.context import ExportContext
-        return ExportContext
+        from Products.CMFSetup.context import DirectoryExportContext
+        return DirectoryExportContext
 
     def test_writeDataFile_simple( self ):
 
@@ -841,6 +854,19 @@
 
         self.assertEqual( ctx.listDirectory( SUBDIR ), None )
 
+    def test_listDirectory_root( self ):
+
+        from string import printable
+
+        SNAPSHOT_ID = 'listDirectory_root'
+        FILENAME = 'simple.txt'
+
+        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
+        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable )
+
+        self.assertEqual( len( ctx.listDirectory( None ) ), 1 )
+        self.failUnless( FILENAME in ctx.listDirectory( None ) )
+
     def test_listDirectory_simple( self ):
 
         from string import printable
@@ -927,8 +953,8 @@
 
 def test_suite():
     return unittest.TestSuite((
-        unittest.makeSuite( ImportContextTests ),
-        unittest.makeSuite( ExportContextTests ),
+        unittest.makeSuite( DirectoryImportContextTests ),
+        unittest.makeSuite( DirectoryExportContextTests ),
         unittest.makeSuite( TarballExportContextTests ),
         unittest.makeSuite( SnapshotExportContextTests ),
         unittest.makeSuite( SnapshotImportContextTests ),



More information about the CMF-checkins mailing list