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

Jim Fulton jim@zope.com
Sun, 23 Mar 2003 13:04:28 -0500


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

Modified Files:
	test_folder.py 
Log Message:
Added code to prevent deleting the last configuration manager from a site-management folder

=== Zope3/src/zope/app/services/tests/test_folder.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/services/tests/test_folder.py:1.1	Sun Mar 23 12:13:42 2003
+++ Zope3/src/zope/app/services/tests/test_folder.py	Sun Mar 23 13:04:27 2003
@@ -29,13 +29,26 @@
         default = traverse(sm, 'default')
         self.assertEqual(default.getConfigurationManager(),
                          default['configure'])
-        del default['configure']
         default.setObject('xxx', ConfigurationManager())
+        del default['configure']
         self.assertEqual(default.getConfigurationManager(),
                          default['xxx'])
-        del default['xxx']
-        self.assertRaises(Exception, # don't care what it raised
-                          default.getConfigurationManager)
+
+
+#       Can't test empty because there's no way to make it empty.
+##         del default['xxx']
+##         self.assertRaises(Exception,
+##                           default.getConfigurationManager)
+
+    def test_cant_remove_last_cm(self):
+        self.buildFolders()
+        sm = placefulsetup.createServiceManager(self.rootFolder)
+        default = traverse(sm, 'default')
+        self.assertRaises(Exception,
+                          default.__delitem__, 'configuration')
+        default.setObject('xxx', ConfigurationManager())
+        del default['configure']
+        
         
 
 def test_suite():