[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_servicemanager.py:1.17

Jim Fulton cvs-admin at zope.org
Fri Nov 21 12:09:56 EST 2003


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

Modified Files:
	test_servicemanager.py 
Log Message:
Added references between site managers.  Each sm has a reference to
the site-manager directly above it (may be the global sm) and to the
site managers directly below it.

(We now love cycles. :)


=== Zope3/src/zope/app/services/tests/test_servicemanager.py 1.16 => 1.17 ===
--- Zope3/src/zope/app/services/tests/test_servicemanager.py:1.16	Sun Sep 21 13:33:25 2003
+++ Zope3/src/zope/app/services/tests/test_servicemanager.py	Fri Nov 21 12:09:55 2003
@@ -18,6 +18,9 @@
 """
 from unittest import TestCase, TestLoader, TextTestRunner
 
+
+from zope.app import zapi
+from zope.app.tests import setup
 from zope.interface import Interface, implements
 from zope.app.services.service import ServiceManager
 from zope.app.services.service import ServiceRegistration
@@ -210,6 +213,29 @@
         self.assertEqual(sm2.resolve("XXX.ZZZ.ZZZ"), 42)
         self.assertEqual(sm2.resolve("XXX.ZZZ."), 42)
         self.assertEqual(sm2.resolve("XXX.ZZZ.x"), "root m2")
+
+    def test_site_manager_connections(self):
+        root = self.rootFolder
+        mr = root.getSiteManager()
+        m1 = setup.createServiceManager(zapi.traverse(root, 'folder1')) 
+        m2 = setup.createServiceManager(zapi.traverse(root, 'folder2'))
+        m111 = setup.createServiceManager(
+            zapi.traverse(root, 'folder1/folder1_1/folder1_1_1'))
+        self.assertEqual(m1.next, mr)
+        self.assertEqual(m2.next, mr)
+        self.assertEqual(m111.next, m1)
+        self.assertEqual(mr.subSites, (m1, m2))
+        self.assertEqual(m1.subSites, (m111, ))
+
+        # Now insert a site and make sure everything is still right:
+        m11 = setup.createServiceManager(
+            zapi.traverse(root, 'folder1/folder1_1'))
+        self.assertEqual(m11.next, m1)
+        self.assertEqual(m111.next, m11)
+        self.assertEqual(m1.subSites, (m11, ))
+        self.assertEqual(m11.subSites, (m111, ))
+
+        
 
 
 def test_suite():




More information about the Zope3-Checkins mailing list