[Zope3-checkins] CVS: Zope3/src/zope/component/tests - placelesssetup.py:1.2.4.1 test_api.py:1.4.2.1 test_providefactory.py:1.2.4.1 test_resources.py:1.2.4.1 test_skins.py:1.2.4.1 test_utilityservice.py:1.2.4.1

Sidnei da Silva sidnei@x3ng.com.br
Tue, 11 Feb 2003 09:42:05 -0500


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

Modified Files:
      Tag: paris-copypasterename-branch
	placelesssetup.py test_api.py test_providefactory.py 
	test_resources.py test_skins.py test_utilityservice.py 
Log Message:
Updating from HEAD to make sure everything still works before merging

=== Zope3/src/zope/component/tests/placelesssetup.py 1.2 => 1.2.4.1 ===
--- Zope3/src/zope/component/tests/placelesssetup.py:1.2	Wed Dec 25 09:13:32 2002
+++ Zope3/src/zope/component/tests/placelesssetup.py	Tue Feb 11 09:41:34 2003
@@ -21,6 +21,8 @@
 
 from zope.testing.cleanup import CleanUp
 from zope.component import getServiceManager
+from zope.component.servicenames import Adapters, Skins, Utilities
+from zope.component.servicenames import ResourceService, Factories
 
 class PlacelessSetup(CleanUp):
     def setUp(self):
@@ -30,29 +32,29 @@
         provideService=sm.provideService
         # factory service
         from zope.component.interfaces import IFactoryService
-        defineService('Factories',IFactoryService)
+        defineService(Factories,IFactoryService)
         from zope.component.factory import factoryService
-        provideService('Factories', factoryService)
+        provideService(Factories, factoryService)
         # utility service
         from zope.component.interfaces import IUtilityService
-        defineService('Utilities',IUtilityService)
+        defineService(Utilities,IUtilityService)
         from zope.component.utility import utilityService
-        provideService('Utilities', utilityService)
+        provideService(Utilities, utilityService)
         # adapter service
         from zope.component.interfaces import IAdapterService
-        defineService('Adapters',IAdapterService)
+        defineService(Adapters,IAdapterService)
         from zope.component.adapter import adapterService
-        provideService('Adapters', adapterService)
+        provideService(Adapters, adapterService)
         # resource service
         from zope.component.interfaces import IResourceService
-        defineService('Resources',IResourceService)
+        defineService(ResourceService,IResourceService)
         from zope.component.resource import resourceService
-        provideService('Resources', resourceService)
+        provideService(ResourceService, resourceService)
         # skin service
         from zope.component.interfaces import ISkinService
-        defineService('Skins',ISkinService)
+        defineService(Skins,ISkinService)
         from zope.component.skin import skinService
-        provideService('Skins', skinService)
+        provideService(Skins, skinService)
         # view service
         from zope.component.interfaces import IViewService
         defineService('Views',IViewService)


=== Zope3/src/zope/component/tests/test_api.py 1.4 => 1.4.2.1 ===
--- Zope3/src/zope/component/tests/test_api.py:1.4	Mon Feb  3 12:43:32 2003
+++ Zope3/src/zope/component/tests/test_api.py	Tue Feb 11 09:41:34 2003
@@ -14,6 +14,7 @@
 import unittest, sys
 from zope.interface import Interface
 from zope.component.tests.request import Request
+from zope.component.servicenames import Adapters
 
 
 class I1(Interface): pass
@@ -68,7 +69,7 @@
         # ...otherwise, you get the default
         self.assertEquals(queryAdapter(ob, I2, Test), Test)
 
-        getService(None, 'Adapters').provideAdapter(I1, I2, Comp)
+        getService(None, Adapters).provideAdapter(I1, I2, Comp)
         c = getAdapter(ob, I2)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
@@ -91,7 +92,7 @@
         # ...otherwise, you get the default
         self.assertEquals(queryAdapter(ob, I2, Test, context=ob), Test)
 
-        getService(None, 'Adapters').provideAdapter(I1, I2, Comp)
+        getService(None, Adapters).provideAdapter(I1, I2, Comp)
         c = getAdapter(ob, I2, context=ob)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)
@@ -117,7 +118,7 @@
 
         class Comp2(Comp): pass
 
-        getService(None, 'Adapters').provideAdapter(I1, I2, Comp2, name='test')
+        getService(None, Adapters).provideAdapter(I1, I2, Comp2, name='test')
         c = getAdapter(ob, I2, name='test')
         self.assertEquals(c.__class__, Comp2)
         self.assertEquals(c.context, ob)
@@ -127,7 +128,7 @@
 
         # Basically, this represents a 2-stage adaptation. You can get
         # from I1 to I2 by way of adapter Comp adapting Comp2
-        getService(None, 'Adapters').provideAdapter(I1, I2, [Comp2, Comp])
+        getService(None, Adapters).provideAdapter(I1, I2, [Comp2, Comp])
         c = getAdapter(ob, I2)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context.context, ob)
@@ -137,7 +138,7 @@
 
         # providing an adapter for None says that your adapter can
         # adapt anything to I2.
-        getService(None, 'Adapters').provideAdapter(None, I2, Comp)
+        getService(None, Adapters).provideAdapter(None, I2, Comp)
         c = getAdapter(ob, I2)
         self.assertEquals(c.__class__, Comp)
         self.assertEquals(c.context, ob)


=== Zope3/src/zope/component/tests/test_providefactory.py 1.2 => 1.2.4.1 ===
--- Zope3/src/zope/component/tests/test_providefactory.py:1.2	Wed Dec 25 09:13:32 2002
+++ Zope3/src/zope/component/tests/test_providefactory.py	Tue Feb 11 09:41:34 2003
@@ -19,6 +19,7 @@
 
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.component.tests.placelesssetup import PlacelessSetup
+from zope.component.servicenames import Factories
 
 
 class ProvideFactoryTestCase(PlacelessSetup, TestCase):
@@ -26,7 +27,7 @@
     def test_provide_factory(self):
         from zope.component import getService, createObject
         from zope.component.tests.factory import f, X, IX
-        factories=getService(None, 'Factories')
+        factories=getService(None, Factories)
         factories.provideFactory("Some.Object", f)
         thing = createObject(None,"Some.Object")
         self.assert_(isinstance(thing, X))


=== Zope3/src/zope/component/tests/test_resources.py 1.2 => 1.2.4.1 ===
--- Zope3/src/zope/component/tests/test_resources.py:1.2	Wed Dec 25 09:13:32 2002
+++ Zope3/src/zope/component/tests/test_resources.py	Tue Feb 11 09:41:34 2003
@@ -22,6 +22,7 @@
 from zope.component.tests.placelesssetup import PlacelessSetup
 from zope.component import getResource, queryResource
 from zope.component.exceptions import ComponentLookupError
+from zope.component.servicenames import Skins, ResourceService
 from zope.interface import Interface
 from zope.component.tests.request import Request
 
@@ -34,13 +35,13 @@
             __implements__ = I2
         class C2(C1): pass
 
-        getService(None,'Resources').provideResource('test', I2, C1)
+        getService(None,ResourceService).provideResource('test', I2, C1)
         self.assertEqual(getResource(None, 'test', Request(I2)).__class__, C1)
-        getService(None,'Skins').defineSkin('foo', I2, ('foo', 'default'))
+        getService(None,Skins).defineSkin('foo', I2, ('foo', 'default'))
         self.assertEqual(
             getResource(None, 'test', Request(I2, 'foo')).__class__,
             C1)
-        getService(None,'Resources').provideResource('test', I2, C2,
+        getService(None,ResourceService).provideResource('test', I2, C2,
                                                      layer='foo')
         self.assertEqual(
             getResource(None, 'test', Request(I2, 'foo')).__class__,
@@ -55,15 +56,15 @@
         class C2(C1): pass
 
 
-        getService(None,'Resources').provideResource('test', I2, C1)
+        getService(None,ResourceService).provideResource('test', I2, C1)
         self.assertEqual(
             getResource(None, 'test', Request(I2, 'default') ).__class__,
             C1)
-        getService(None,'Skins').defineSkin('foo', I2, ('foo', 'default'))
+        getService(None,Skins).defineSkin('foo', I2, ('foo', 'default'))
         self.assertEqual(
             getResource(None, 'test', Request(I2, 'foo')).__class__,
             C1)
-        getService(None,'Resources').provideResource('test', I2, C2,
+        getService(None,ResourceService).provideResource('test', I2, C2,
                                                      layer='foo')
         self.assertEqual(
             getResource(None, 'test', Request(I2, 'foo')).__class__,


=== Zope3/src/zope/component/tests/test_skins.py 1.2 => 1.2.4.1 ===
--- Zope3/src/zope/component/tests/test_skins.py:1.2	Wed Dec 25 09:13:32 2002
+++ Zope3/src/zope/component/tests/test_skins.py	Tue Feb 11 09:41:34 2003
@@ -16,6 +16,7 @@
 from zope.component.tests.placelesssetup import PlacelessSetup
 from zope.component import getView, getService, queryView
 from zope.component.exceptions import ComponentLookupError
+from zope.component.servicenames import Skins
 from zope.interface import Interface
 from zope.component.tests.request import Request
 
@@ -37,7 +38,7 @@
 
         getService(None, 'Views').provideView(I1, 'test', I2, [C1])
         self.assertEqual(getView(O(), 'test', Request(I2)).__class__, C1)
-        getService(None, 'Skins').defineSkin('foo', I2, ('foo', 'default'))
+        getService(None, Skins).defineSkin('foo', I2, ('foo', 'default'))
         self.assertEqual(getView(O(), 'test', Request(I2, 'foo')).__class__,
                          C1)
         getService(None, 'Views').provideView(None, 'test', I2, [C2])
@@ -72,7 +73,7 @@
         getService(None, 'Views').provideView(I1, 'test', I2, [C1])
         self.assertEqual(getView(O(), 'test',
             Request(I2,'') ).__class__, C1)
-        getService(None, 'Skins').defineSkin('foo', I2, ('foo', 'default'))
+        getService(None, Skins).defineSkin('foo', I2, ('foo', 'default'))
 
         self.assertEqual(getView(O(), 'test',
             Request(I2, 'foo')).__class__, C1)


=== Zope3/src/zope/component/tests/test_utilityservice.py 1.2 => 1.2.4.1 ===
--- Zope3/src/zope/component/tests/test_utilityservice.py:1.2	Wed Dec 25 09:13:32 2002
+++ Zope3/src/zope/component/tests/test_utilityservice.py	Tue Feb 11 09:41:34 2003
@@ -22,6 +22,7 @@
 from zope.component import \
      getUtility, getService, queryUtility, getServiceManager
 from zope.component.exceptions import ComponentLookupError
+from zope.component.servicenames import Utilities
 from zope.interface import Interface
 
 from zope.testing.cleanup import CleanUp # Base class w registry cleanup
@@ -46,14 +47,14 @@
         provideService('Utilities', utilityService)
 
     def testGetUtility(self):
-        us = getService(None, "Utilities")
+        us = getService(None, Utilities)
         self.assertRaises(
             ComponentLookupError, getUtility, None, IDummyService)
         us.provideUtility(IDummyService, dummyService)
         self.assertEqual(getUtility(None, IDummyService), dummyService)
 
     def testQueryUtility(self):
-        us = getService(None, "Utilities")
+        us = getService(None, Utilities)
         self.assertEqual(queryUtility(None, IDummyService), None)
         self.assertEqual(queryUtility(None, IDummyService, self), self)
         us.provideUtility(IDummyService, dummyService)