[Zope3-checkins] CVS: Zope3/src/zope/component/tests - test_providefactory.py:1.8

Garrett Smith garrett at mojave-corp.com
Thu Jan 8 15:48:23 EST 2004


Update of /cvs-repository/Zope3/src/zope/component/tests
In directory cvs.zope.org:/tmp/cvs-serv3742/src/zope/component/tests

Modified Files:
	test_providefactory.py 
Log Message:
Added factory 'info' to the factory service. This can be used to lookup
title and description for registered factories. Prior to this change, factory 
title and description defined in ZCML was discarded.

This change is per an exchange back in May:

http://mail.zope.org/pipermail/zope3-dev/2003-May/006915.html

Note that only the factory info portion of the proposed change is 
implemented in this commit. The ability to enumerate registered factories
was implemented earlier.


=== Zope3/src/zope/component/tests/test_providefactory.py 1.7 => 1.8 ===
--- Zope3/src/zope/component/tests/test_providefactory.py:1.7	Mon Aug 25 10:14:09 2003
+++ Zope3/src/zope/component/tests/test_providefactory.py	Thu Jan  8 15:48:22 2004
@@ -55,6 +55,18 @@
         factories.provideFactory("Some.Object", f)
         self.assertEqual(factories.queryFactoriesFor(IFoo, None), None)
 
+    def test_getFactoryInfo(self):
+        from zope.component import getService
+        from zope.component.tests.factory import f
+        from zope.component.factory import FactoryInfo
+        factories = getService(None, Factories)
+        info = FactoryInfo('Some Object', 'An object for testing.')
+        factories.provideFactory("Some.Object", f, info)
+        info = factories.getFactoryInfo('Some.Object')
+        self.assertEquals(info.title, 'Some Object')
+        self.assertEquals(info.description, 'An object for testing.')
+        self.assert_(factories.getFactoryInfo('Unregistered.Object') is None)
+
 def test_suite():
     return makeSuite(ProvideFactoryTestCase)
 




More information about the Zope3-Checkins mailing list