[Zope3-checkins] CVS: Zope3/src/zope/app/renderer/tests - test_vocabulary.py:1.5

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Mar 9 07:39:40 EST 2004


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

Modified Files:
	test_vocabulary.py 
Log Message:


Adjusted code to use utility service to look up factories or use the new zapi
methods.




=== Zope3/src/zope/app/renderer/tests/test_vocabulary.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/renderer/tests/test_vocabulary.py:1.4	Fri Mar  5 17:09:15 2004
+++ Zope3/src/zope/app/renderer/tests/test_vocabulary.py	Tue Mar  9 07:39:09 2004
@@ -18,10 +18,11 @@
 import unittest
 
 from zope.app import zapi
+from zope.app.tests import ztapi
 from zope.app.renderer import SourceFactory
 from zope.app.renderer.interfaces import ISource
 from zope.app.renderer.vocabulary import SourceTypeTerm, SourceTypeVocabulary
-from zope.component.factory import FactoryInfo
+from zope.component.interfaces import IFactory
 from zope.component.tests.placelesssetup import PlacelessSetup
 from zope.schema.interfaces import \
      ITokenizedTerm, IVocabulary, IVocabularyTokenized
@@ -30,19 +31,19 @@
 class IFoo(ISource):
     """Source marker interface"""
 
-FooFactory = SourceFactory(IFoo)
+FooFactory = SourceFactory(IFoo, 'Foo', 'Foo Source')
 
 class IFoo2(ISource):
     """Source marker interface"""
 
-Foo2Factory = SourceFactory(IFoo2)
+Foo2Factory = SourceFactory(IFoo2, 'Foo2', 'Foo2 Source')
 
 
 
 class SourceTypeTermTest(unittest.TestCase):
 
     def setUp(self):
-        self.term = SourceTypeTerm('zope.Foo', FactoryInfo('Foo', 'Foo Source'))
+        self.term = SourceTypeTerm('zope.Foo', FooFactory)
 
     def test_Interface(self):
         self.failUnless(ITokenizedTerm.providedBy(self.term))
@@ -59,11 +60,8 @@
     def setUp(self):
         super(SourceTypeVocabularyTest, self).setUp()
         
-        factories = zapi.getService(None, 'Factories')
-        factories.provideFactory('zope.source.Foo', FooFactory,
-                                 FactoryInfo('Foo', 'Foo Source'))
-        factories.provideFactory('zope.source.Foo2', Foo2Factory,
-                                 FactoryInfo('Foo2', 'Foo2 Source'))
+        ztapi.provideUtility(IFactory, FooFactory, 'zope.source.Foo')
+        ztapi.provideUtility(IFactory, Foo2Factory, 'zope.source.Foo2')
 
         self.vocab = SourceTypeVocabulary(None)
 




More information about the Zope3-Checkins mailing list