Commit caa4fc8d authored by Stefan H. Holek's avatar Stefan H. Holek

Test interfaces with verifyClass in addition to verifyObject.

parent abc79c40
...@@ -12,97 +12,114 @@ ...@@ -12,97 +12,114 @@
############################################################################## ##############################################################################
"""Interface tests """Interface tests
$Id: testInterfaces.py,v 1.3 2005/01/01 20:38:16 shh42 Exp $ $Id$
""" """
import os, sys import os, sys
if __name__ == '__main__': if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py')) execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase from Testing.ZopeTestCase import *
from Testing.ZopeTestCase.interfaces import * from Testing.ZopeTestCase.interfaces import *
try: from Interface.Verify import verifyClass
from Interface.Verify import verifyObject from Interface.Verify import verifyObject
have_verify = 1
except ImportError:
print 'testInterfaces.py: The tests in this module require Zope >= 2.6'
have_verify = 0
class TestBaseTestCase(ZopeTestCase.TestCase): class TestAbstractClasses(TestCase):
_setup_fixture = 0 def testIProfiled(self):
self.failUnless(verifyClass(IProfiled, Profiled))
def testIFunctional(self):
self.failUnless(verifyClass(IFunctional, Functional))
class TestBaseTestCase(TestCase):
def testIProfiled(self): def testIProfiled(self):
self.failUnless(verifyClass(IProfiled, TestCase))
self.failUnless(verifyObject(IProfiled, self)) self.failUnless(verifyObject(IProfiled, self))
def testIZopeTestCase(self): def testIZopeTestCase(self):
self.failUnless(verifyClass(IZopeTestCase, TestCase))
self.failUnless(verifyObject(IZopeTestCase, self)) self.failUnless(verifyObject(IZopeTestCase, self))
class TestZopeTestCase(ZopeTestCase.ZopeTestCase): class TestZopeTestCase(ZopeTestCase):
_setup_fixture = 0 _setup_fixture = 0
def testIProfiled(self): def testIProfiled(self):
self.failUnless(verifyClass(IProfiled, ZopeTestCase))
self.failUnless(verifyObject(IProfiled, self)) self.failUnless(verifyObject(IProfiled, self))
def testIZopeTestCase(self): def testIZopeTestCase(self):
self.failUnless(verifyClass(IZopeTestCase, ZopeTestCase))
self.failUnless(verifyObject(IZopeTestCase, self)) self.failUnless(verifyObject(IZopeTestCase, self))
def testIZopeSecurity(self): def testIZopeSecurity(self):
self.failUnless(verifyClass(IZopeSecurity, ZopeTestCase))
self.failUnless(verifyObject(IZopeSecurity, self)) self.failUnless(verifyObject(IZopeSecurity, self))
class TestFunctionalTestCase(ZopeTestCase.FunctionalTestCase): class TestFunctionalTestCase(FunctionalTestCase):
_setup_fixture = 0 _setup_fixture = 0
def testIFunctional(self): def testIFunctional(self):
self.failUnless(verifyClass(IFunctional, FunctionalTestCase))
self.failUnless(verifyObject(IFunctional, self)) self.failUnless(verifyObject(IFunctional, self))
def testIProfiled(self): def testIProfiled(self):
self.failUnless(verifyClass(IProfiled, FunctionalTestCase))
self.failUnless(verifyObject(IProfiled, self)) self.failUnless(verifyObject(IProfiled, self))
def testIZopeTestCase(self): def testIZopeTestCase(self):
self.failUnless(verifyClass(IZopeTestCase, FunctionalTestCase))
self.failUnless(verifyObject(IZopeTestCase, self)) self.failUnless(verifyObject(IZopeTestCase, self))
def testIZopeSecurity(self): def testIZopeSecurity(self):
self.failUnless(verifyClass(IZopeSecurity, FunctionalTestCase))
self.failUnless(verifyObject(IZopeSecurity, self)) self.failUnless(verifyObject(IZopeSecurity, self))
class TestPortalTestCase(ZopeTestCase.PortalTestCase): class TestPortalTestCase(PortalTestCase):
_configure_portal = 0 _configure_portal = 0
def getPortal(self): def _portal(self):
return None return None
def testIProfiled(self): def testIProfiled(self):
self.failUnless(verifyClass(IProfiled, PortalTestCase))
self.failUnless(verifyObject(IProfiled, self)) self.failUnless(verifyObject(IProfiled, self))
def testIZopeTestCase(self): def testIZopeTestCase(self):
self.failUnless(verifyClass(IZopeTestCase, PortalTestCase))
self.failUnless(verifyObject(IZopeTestCase, self)) self.failUnless(verifyObject(IZopeTestCase, self))
def testIZopeSecurity(self): def testIZopeSecurity(self):
self.failUnless(verifyClass(IZopeSecurity, PortalTestCase))
self.failUnless(verifyObject(IZopeSecurity, self)) self.failUnless(verifyObject(IZopeSecurity, self))
def testIPortalTestCase(self): def testIPortalTestCase(self):
self.failUnless(verifyClass(IPortalTestCase, PortalTestCase))
self.failUnless(verifyObject(IPortalTestCase, self)) self.failUnless(verifyObject(IPortalTestCase, self))
def testIPortalSecurity(self): def testIPortalSecurity(self):
self.failUnless(verifyClass(IPortalSecurity, PortalTestCase))
self.failUnless(verifyObject(IPortalSecurity, self)) self.failUnless(verifyObject(IPortalSecurity, self))
def test_suite(): def test_suite():
from unittest import TestSuite, makeSuite from unittest import TestSuite, makeSuite
suite = TestSuite() suite = TestSuite()
if have_verify: suite.addTest(makeSuite(TestAbstractClasses))
suite.addTest(makeSuite(TestBaseTestCase)) suite.addTest(makeSuite(TestBaseTestCase))
suite.addTest(makeSuite(TestZopeTestCase)) suite.addTest(makeSuite(TestZopeTestCase))
suite.addTest(makeSuite(TestFunctionalTestCase)) suite.addTest(makeSuite(TestFunctionalTestCase))
suite.addTest(makeSuite(TestPortalTestCase)) suite.addTest(makeSuite(TestPortalTestCase))
return suite return suite
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment