[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture/tests - testService.py:1.1.2.5

Steve Alexander steve@cat-box.net
Mon, 4 Mar 2002 14:57:05 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture/tests
In directory cvs.zope.org:/tmp/cvs-serv18993

Modified Files:
      Tag: Zope-3x-branch
	testService.py 
Log Message:
Added previously missing coverage for getServiceDefinitions()


=== Zope3/lib/python/Zope/ComponentArchitecture/tests/testService.py 1.1.2.4 => 1.1.2.5 ===
 
 from Zope.ComponentArchitecture import defineService, provideService
-from Zope.ComponentArchitecture import getService
+from Zope.ComponentArchitecture import getServiceDefinitions, getService
 from Zope.ComponentArchitecture.Service import UndefinedService, InvalidService
 from Zope.ComponentArchitecture.ServiceManagerContainer import ServiceManagerContainer
 from Zope.Exceptions import DuplicationError
@@ -35,7 +35,7 @@
     __implements__ = IOne
 
 class ServiceTwo:
-    pass
+    __implements__ = ITwo
 
 class Test(CleanUp, unittest.TestCase):
         
@@ -87,6 +87,19 @@
         smc = ServiceManagerContainer()
         self.assertEqual(id(getService(smc, 'one')), id(c))
         
+    def testGetServiceDefinitions(self):
+        """test that the service definitions are the ones we added"""
+        defineService('one', IOne)
+        c = ServiceOne()
+        provideService('one', c)
+        
+        defineService('two', ITwo)
+        d = ServiceTwo()
+        provideService('two', d)
+        defs = getServiceDefinitions()
+        defs.sort()
+        self.assertEqual(defs,
+            [('one', IOne), ('two', ITwo)])
         
 def test_suite():
     loader=unittest.TestLoader()