[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_interfaceservice.py:1.2

Jeremy Hylton jeremy@zope.com
Sun, 22 Jun 2003 16:23:27 -0400


Update of /cvs-repository/Zope3/src/zope/app/services/tests
In directory cvs.zope.org:/tmp/cvs-serv18882/src/zope/app/services/tests

Modified Files:
	test_interfaceservice.py 
Log Message:
Update LocalInterfaceService to implement items() and use new tests.
Add interface with security assertions.


=== Zope3/src/zope/app/services/tests/test_interfaceservice.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/services/tests/test_interfaceservice.py:1.1	Sun Jun 22 15:02:21 2003
+++ Zope3/src/zope/app/services/tests/test_interfaceservice.py	Sun Jun 22 16:23:27 2003
@@ -24,25 +24,10 @@
 from zope.app.services.servicenames import Interfaces
 from zope.app.tests import setup
 
+from zope.app.component.tests.absIInterfaceService \
+     import IInterfaceServiceTests
 
-class B(Interface):
-    pass
-
-class I(Interface):
-    """bah blah."""
-
-class I2(B):
-    """eek"""
-
-class I3(B):
-
-    def one():
-        """method one"""
-
-    def two():
-        """method two"""
-
-class Test(unittest.TestCase):
+class Test(IInterfaceServiceTests, unittest.TestCase):
     """Test Interface for LocalInterfaceService instance."""
 
     def setUp(self):
@@ -51,47 +36,11 @@
     def tearDown(self):
         setup.placefulTearDown()
         
-    def testInterfaceVerification(self):
-        verifyObject(IInterfaceService, LocalInterfaceService())
-
-    def testDelegationToGlobalInterfaceService(self):
+    def getServices(self):
         rootFolder = setup.buildSampleFolderTree()
         mgr = setup.createServiceManager(rootFolder)
-        
         service = setup.addService(mgr, Interfaces, LocalInterfaceService())
-
-        self.assertRaises(ComponentLookupError,
-                          service.getInterface, "Foo.Bar")
-        self.assertEqual(service.queryInterface("Foo.Bar"), None)
-        self.assertEqual(service.queryInterface("Foo.Bar", 42), 42)
-        self.failIf(service.searchInterface(""))
-
-        globalService.provideInterface("Foo.Bar", I)
-
-        self.assertEqual(service.getInterface("Foo.Bar"), I)
-        self.assertEqual(service.queryInterface("Foo.Bar"), I)
-        self.assertEqual(list(service.searchInterface("")), [I])
-        self.assertEqual(list(service.searchInterface(base=B)), [])
-
-        globalService.provideInterface("Foo.Baz", I2)
-
-        result = list(service.searchInterface(""))
-        result.sort()
-        self.assertEqual(result, [I, I2])
-
-        self.assertEqual(list(service.searchInterface("I2")), [I2])
-        self.assertEqual(list(service.searchInterface("eek")), [I2])
-
-        self.assertEqual(list(service.searchInterfaceIds("I2")), ["Foo.Baz"])
-        self.assertEqual(list(service.searchInterfaceIds("eek")), ["Foo.Baz"])
-
-        globalService.provideInterface("Foo.Bus", I3)
-        self.assertEqual(list(service.searchInterface("two")), [I3])
-        self.assertEqual(list(service.searchInterface("two", base=B)), [I3])
-
-        r = list(service.searchInterface(base=B))
-        r.sort()
-        self.assertEqual(r, [I2, I3])
+        return service, globalService
 
 def test_suite():
     return unittest.makeSuite(Test)