[Zope-CVS] CVS: Products/Zelenium/tests - test_zuite.py:1.4

Tres Seaver tseaver at palladion.com
Sat May 7 16:33:55 EDT 2005


Update of /cvs-repository/Products/Zelenium/tests
In directory cvs.zope.org:/tmp/cvs-serv29299/tests

Modified Files:
	test_zuite.py 
Log Message:


   - Add support, with tests, for returning testcases from a mapped directory
     path, including recursion through subdirectories of that path.
     
     Currently, the implementation has the following issues:

     o It doesn't provide control over the order in which test cases or
       subdirectories are returned.

     o It doesn't allow exclusion / filtering of subdirectories or
       test cases.

     o It only creates OFS.Image.File objects for test cases (no templates,
       scripts, etc.)


=== Products/Zelenium/tests/test_zuite.py 1.3 => 1.4 ===
--- Products/Zelenium/tests/test_zuite.py:1.3	Sat May  7 15:03:58 2005
+++ Products/Zelenium/tests/test_zuite.py	Sat May  7 16:33:25 2005
@@ -154,6 +154,43 @@
             object = zuite[ name ]
             self.assertEqual( object.meta_type, 'File' )
 
+    def test___getitem___filesystem( self ):
+
+        import os
+        from Globals import package_home
+
+        zuite = self._makeOne()
+        zuite._updateProperty( 'filesystem_path'
+                             , os.path.join( package_home( globals() )
+                                           , 'flat'
+                                           )
+                             )
+
+        for name in ( 'test_simple.html'
+                    ,
+                    ):
+            object = zuite[ name ]
+            self.assertEqual( object.meta_type, 'File' )
+
+    def test___getitem___filesystem_recursive( self ):
+
+        import os
+        from Globals import package_home
+
+        zuite = self._makeOne()
+        zuite._updateProperty( 'filesystem_path'
+                             , os.path.join( package_home( globals() )
+                                           , 'nested'
+                                           )
+                             )
+
+        for subdir, name in ( ( 'one', 'test_one.html' )
+                            , ( 'two', 'test_another.html' )
+                            ):
+            proxy = zuite[ subdir ]
+            object = proxy[ name ]
+            self.assertEqual( object.meta_type, 'File' )
+
     def test_listTestCases_simple( self ):
 
         _TEST_IDS = ( 'test_one'
@@ -223,6 +260,40 @@
         self.assertEqual( len( cases ), len( _TEST_IDS ) )
         for case in cases:
             self.failUnless( case[ 'id' ] in _TEST_IDS )
+
+    def test_listTestCases_filesystem( self ):
+
+        import os
+        from Globals import package_home
+
+        zuite = self._makeOne()
+        zuite._updateProperty( 'filesystem_path'
+                             , os.path.join( package_home( globals() )
+                                           , 'flat'
+                                           )
+                             )
+
+        cases = zuite.listTestCases()
+        self.assertEqual( len( cases ), 1 )
+        self.assertEqual( cases[ 0 ][ 'id' ], 'test_simple.html' )
+
+    def test_listTestCases_filesystem_recursive( self ):
+
+        import os
+        from Globals import package_home
+
+        zuite = self._makeOne()
+        zuite._updateProperty( 'filesystem_path'
+                             , os.path.join( package_home( globals() )
+                                           , 'nested'
+                                           )
+                             )
+
+        cases = zuite.listTestCases()
+        self.assertEqual( len( cases ), 2 )
+        case_ids = [ x[ 'id' ] for x in cases ]
+        self.failUnless( 'test_one.html' in case_ids )
+        self.failUnless( 'test_another.html' in case_ids )
 
     def test_getZipFileName( self ):
 



More information about the Zope-CVS mailing list