[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_utility.py:1.4

Guido van Rossum guido@python.org
Tue, 29 Apr 2003 12:37:40 -0400


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

Modified Files:
	test_utility.py 
Log Message:
Add a unit test for the case where getRegisteredMatching() finds an
empty configuration registry (these should not be returned).


=== Zope3/src/zope/app/services/tests/test_utility.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/tests/test_utility.py:1.3	Thu Apr  3 17:05:34 2003
+++ Zope3/src/zope/app/services/tests/test_utility.py	Tue Apr 29 12:37:39 2003
@@ -27,7 +27,8 @@
 from zope.component.exceptions import ComponentLookupError
 from zope.app.traversing import traverse, getPath
 from zope.app.interfaces.services.configuration import IConfigurationRegistry
-from zope.app.interfaces.services.configuration import Active, Registered
+from zope.app.interfaces.services.configuration \
+     import Active, Registered, Unregistered
 from zope.app.interfaces.services.utility import ILocalUtility
 from zope.app.interfaces.services.configuration import IUseConfiguration
 from zope.app.interfaces.dependable import IDependable
@@ -194,6 +195,12 @@
         self.assertEqual(r, [(IFoo, "", cr1), (IFoo, "bob", cr2)])
         self.assertEqual(getWrapperContainer(r[0][2]), utilities)
         self.assertEqual(getWrapperContainer(r[1][2]), utilities)
+        # Now test that an empty registry doesn't show up
+        for cd in cr1.info(): # Remove everything from cr1
+            cd['configuration'].status = Unregistered
+        self.assertEqual(bool(cr1), False)
+        r = list(utilities.getRegisteredMatching())
+        self.assertEqual(r, [(IFoo, "bob", cr2)])
 
 
 def test_suite():