[Zope-Checkins] SVN: Zope/trunk/lib/python/ added some basic conformance tests

Yvo Schubbe y.2005- at wcm-solutions.de
Sun May 15 12:02:37 EDT 2005


Log message for revision 30357:
  added some basic conformance tests

Changed:
  UU  Zope/trunk/lib/python/OFS/tests/testFileAndImage.py
  A   Zope/trunk/lib/python/OFS/tests/testFolder.py
  UU  Zope/trunk/lib/python/OFS/tests/testOrderSupport.py
  UU  Zope/trunk/lib/python/OFS/tests/testOrderedFolder.py
  A   Zope/trunk/lib/python/webdav/tests/
  A   Zope/trunk/lib/python/webdav/tests/__init__.py
  A   Zope/trunk/lib/python/webdav/tests/testEtagSupport.py
  A   Zope/trunk/lib/python/webdav/tests/testLockItem.py
  A   Zope/trunk/lib/python/webdav/tests/testNullResource.py

-=-
Modified: Zope/trunk/lib/python/OFS/tests/testFileAndImage.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testFileAndImage.py	2005-05-15 15:56:18 UTC (rev 30356)
+++ Zope/trunk/lib/python/OFS/tests/testFileAndImage.py	2005-05-15 16:02:37 UTC (rev 30357)
@@ -1,3 +1,5 @@
+import unittest
+
 import Testing
 import Zope2
 Zope2.startup()
@@ -3,5 +5,4 @@
 
 import os, sys
-import unittest
 import time
 from cStringIO import StringIO
@@ -47,11 +48,11 @@
 class DummyCache:
     def __init__(self):
         self.clear()
-        
+
     def ZCache_set(self, ob, data, view_name='', keywords=None,
                    mtime_func=None):
         self.set = (ob, data)
-    
+
     def ZCache_get(self, ob, data, view_name='', keywords=None,
                    mtime_func=None):
         self.get = ob
@@ -69,14 +70,14 @@
 
     def setStreamIterator(self, si):
         self.si = si
-    
 
+
 ADummyCache=DummyCache()
 
 class DummyCacheManager(SimpleItem):
     def ZCacheManager_getCache(self):
         return ADummyCache
-    
+
 class FileTests(unittest.TestCase):
     data = open(filedata, 'rb').read()
     content_type = 'application/octet-stream'
@@ -152,7 +153,7 @@
         self.assertEqual(self.file.content_type, 'text/plain')
         self.failUnless(ADummyCache.invalidated)
         self.failUnless(ADummyCache.set)
-        
+
     def testManageEditWithoutFileData(self):
         self.file.manage_edit('foobar', 'text/plain')
         self.assertEqual(self.file.title, 'foobar')
@@ -242,6 +243,16 @@
         self.assertEqual(len(results), 1)
         self.assertEqual(results[0][1], self.file)
 
+    def test_z2interfaces(self):
+        from Interface.Verify import verifyClass
+        from OFS.Image import File
+        from webdav.WriteLockInterface import WriteLockInterface
+        from ZPublisher.HTTPRangeSupport import HTTPRangeInterface
+
+        verifyClass(HTTPRangeInterface, File)
+        verifyClass(WriteLockInterface, File)
+
+
 class ImageTests(FileTests):
     data = open(filedata, 'rb').read()
     content_type = 'image/gif'
@@ -255,7 +266,7 @@
         self.assertEqual(self.file.height, 16)
         self.failUnless(ADummyCache.invalidated)
         self.failUnless(ADummyCache.set)
-        
+
     def testStr(self):
         self.assertEqual(str(self.file),
           ('<img src="http://foo/file" alt="" title="" height="16" width="16" />'))
@@ -266,12 +277,20 @@
 
     def testViewImageOrFile(self):
         pass # dtml method,screw it
-    
+
+    def test_z2interfaces(self):
+        from Interface.Verify import verifyClass
+        from OFS.Image import Image
+        from webdav.WriteLockInterface import WriteLockInterface
+
+        verifyClass(WriteLockInterface, Image)
+
+
 def test_suite():
-    suite = unittest.TestSuite()
-    suite.addTest( unittest.makeSuite( FileTests ) )
-    suite.addTest( unittest.makeSuite( ImageTests ))
-    return suite
+    return unittest.TestSuite((
+        unittest.makeSuite(FileTests),
+        unittest.makeSuite(ImageTests),
+        ))
 
-if __name__ == "__main__":
-    unittest.main()
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope/trunk/lib/python/OFS/tests/testFileAndImage.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.2
Name: svn:keywords
   + Id

Added: Zope/trunk/lib/python/OFS/tests/testFolder.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testFolder.py	2005-05-15 15:56:18 UTC (rev 30356)
+++ Zope/trunk/lib/python/OFS/tests/testFolder.py	2005-05-15 16:02:37 UTC (rev 30357)
@@ -0,0 +1,20 @@
+import unittest
+
+
+class TestFolder(unittest.TestCase):
+
+    def test_z2interfaces(self):
+        from Interface.Verify import verifyClass
+        from OFS.Folder import Folder
+        from webdav.WriteLockInterface import WriteLockInterface
+
+        verifyClass(WriteLockInterface, Folder)
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(TestFolder),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope/trunk/lib/python/OFS/tests/testFolder.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope/trunk/lib/python/OFS/tests/testOrderSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testOrderSupport.py	2005-05-15 15:56:18 UTC (rev 30356)
+++ Zope/trunk/lib/python/OFS/tests/testOrderSupport.py	2005-05-15 16:02:37 UTC (rev 30357)
@@ -1,14 +1,13 @@
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
 
 import Testing
 import Zope2
 Zope2.startup()
-from Interface.Verify import verifyClass
 
 from OFS.CopySupport import CopySource
 from OFS.ObjectManager import ObjectManager
-from OFS.OrderSupport import OrderSupport
 
+
 class DummyObject(CopySource):
     def __init__(self, id, meta_type):
         self.id = id
@@ -22,15 +21,17 @@
     def wl_isLocked(self):
         return 0
 
-class OrderedObjectManager(OrderSupport, ObjectManager):
-    # disable permission verification
-    def _verifyObjectPaste(self, object, validate_src=1):
-        return
 
+class TestOrderSupport(unittest.TestCase):
 
-class TestOrderSupport(TestCase):
+    def _makeOne(self):
+        from OFS.OrderSupport import OrderSupport
 
-    def _makeOne(self):
+        class OrderedObjectManager(OrderSupport, ObjectManager):
+            # disable permission verification
+            def _verifyObjectPaste(self, object, validate_src=1):
+                return
+
         f = OrderedObjectManager()
         f._objects = ( {'id':'o1', 'meta_type':'mt1'}
                      , {'id':'o2', 'meta_type':'mt2'}
@@ -159,14 +160,18 @@
         f.setDefaultSorting('position', True)
         self.failUnlessEqual( f.tpValues(), [f.o4, f.o3, f.o2] )
 
-    def test_interface(self):
+    def test_z2interfaces(self):
+        from Interface.Verify import verifyClass
         from OFS.IOrderSupport import IOrderedContainer
+        from OFS.OrderSupport import OrderSupport
 
         verifyClass(IOrderedContainer, OrderSupport)
 
 
 def test_suite():
-    return TestSuite( ( makeSuite(TestOrderSupport), ) )
+    return unittest.TestSuite((
+        unittest.makeSuite(TestOrderSupport),
+        ))
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope/trunk/lib/python/OFS/tests/testOrderSupport.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.3
Name: svn:keywords
   + Id

Modified: Zope/trunk/lib/python/OFS/tests/testOrderedFolder.py
===================================================================
--- Zope/trunk/lib/python/OFS/tests/testOrderedFolder.py	2005-05-15 15:56:18 UTC (rev 30356)
+++ Zope/trunk/lib/python/OFS/tests/testOrderedFolder.py	2005-05-15 16:02:37 UTC (rev 30357)
@@ -1,17 +1,12 @@
-from unittest import TestCase, TestSuite, makeSuite, main
+import unittest
 
-import Testing
-import Zope2
-Zope2.startup()
-from Interface.Verify import verifyClass
 
-from OFS.OrderedFolder import OrderedFolder
+class TestOrderedFolder(unittest.TestCase):
 
-
-class TestOrderedFolder(TestCase):
-
-    def test_interface(self):
+    def test_z2interfaces(self):
+        from Interface.Verify import verifyClass
         from OFS.IOrderSupport import IOrderedContainer
+        from OFS.OrderedFolder import OrderedFolder
         from webdav.WriteLockInterface import WriteLockInterface
 
         verifyClass(IOrderedContainer, OrderedFolder)
@@ -19,7 +14,9 @@
 
 
 def test_suite():
-    return TestSuite( ( makeSuite(TestOrderedFolder), ) )
+    return unittest.TestSuite((
+        unittest.makeSuite(TestOrderedFolder),
+        ))
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope/trunk/lib/python/OFS/tests/testOrderedFolder.py
___________________________________________________________________
Name: cvs2svn:cvs-rev
   - 1.3
Name: svn:keywords
   + Id


Property changes on: Zope/trunk/lib/python/webdav/tests
___________________________________________________________________
Name: svn:ignore
   + *so
*.pyc
build


Added: Zope/trunk/lib/python/webdav/tests/__init__.py
===================================================================
--- Zope/trunk/lib/python/webdav/tests/__init__.py	2005-05-15 15:56:18 UTC (rev 30356)
+++ Zope/trunk/lib/python/webdav/tests/__init__.py	2005-05-15 16:02:37 UTC (rev 30357)
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.


Property changes on: Zope/trunk/lib/python/webdav/tests/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: Zope/trunk/lib/python/webdav/tests/testEtagSupport.py
===================================================================
--- Zope/trunk/lib/python/webdav/tests/testEtagSupport.py	2005-05-15 15:56:18 UTC (rev 30356)
+++ Zope/trunk/lib/python/webdav/tests/testEtagSupport.py	2005-05-15 16:02:37 UTC (rev 30357)
@@ -0,0 +1,20 @@
+import unittest
+
+
+class TestEtagSupport(unittest.TestCase):
+
+    def test_z2interfaces(self):
+        from Interface.Verify import verifyClass
+        from webdav.EtagSupport import EtagBaseInterface
+        from webdav.EtagSupport import EtagSupport
+
+        verifyClass(EtagBaseInterface, EtagSupport)
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(TestEtagSupport),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope/trunk/lib/python/webdav/tests/testEtagSupport.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: Zope/trunk/lib/python/webdav/tests/testLockItem.py
===================================================================
--- Zope/trunk/lib/python/webdav/tests/testLockItem.py	2005-05-15 15:56:18 UTC (rev 30356)
+++ Zope/trunk/lib/python/webdav/tests/testLockItem.py	2005-05-15 16:02:37 UTC (rev 30357)
@@ -0,0 +1,20 @@
+import unittest
+
+
+class TestLockItem(unittest.TestCase):
+
+    def test_z2interfaces(self):
+        from Interface.Verify import verifyClass
+        from webdav.LockItem import LockItem
+        from webdav.WriteLockInterface import LockItemInterface
+
+        verifyClass(LockItemInterface, LockItem)
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(TestLockItem),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope/trunk/lib/python/webdav/tests/testLockItem.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: Zope/trunk/lib/python/webdav/tests/testNullResource.py
===================================================================
--- Zope/trunk/lib/python/webdav/tests/testNullResource.py	2005-05-15 15:56:18 UTC (rev 30356)
+++ Zope/trunk/lib/python/webdav/tests/testNullResource.py	2005-05-15 16:02:37 UTC (rev 30357)
@@ -0,0 +1,31 @@
+import unittest
+
+
+class TestLockNullResource(unittest.TestCase):
+
+    def test_z2interfaces(self):
+        from Interface.Verify import verifyClass
+        from webdav.NullResource import LockNullResource
+        from webdav.WriteLockInterface import WriteLockInterface
+
+        verifyClass(WriteLockInterface, LockNullResource)
+
+
+class TestNullResource(unittest.TestCase):
+
+    def test_z2interfaces(self):
+        from Interface.Verify import verifyClass
+        from webdav.NullResource import NullResource
+        from webdav.WriteLockInterface import WriteLockInterface
+
+        verifyClass(WriteLockInterface, NullResource)
+
+
+def test_suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(TestLockNullResource),
+        unittest.makeSuite(TestNullResource),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope/trunk/lib/python/webdav/tests/testNullResource.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Zope-Checkins mailing list