[Zope3-checkins] CVS: Zope3/src/zope/app/dav/tests - test_directives.py:1.3 test_propfind.py:1.15 test_davschemaservice.py:NONE

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Mar 3 12:07:02 EST 2004


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

Modified Files:
	test_directives.py test_propfind.py 
Removed Files:
	test_davschemaservice.py 
Log Message:


Changed DAV schemas to be utilities. However, I left the dav:provideInterface
directive in place, since it hides some unnecessary indirections.




=== Zope3/src/zope/app/dav/tests/test_directives.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/dav/tests/test_directives.py:1.2	Thu Nov 27 08:59:18 2003
+++ Zope3/src/zope/app/dav/tests/test_directives.py	Wed Mar  3 12:06:31 2004
@@ -17,30 +17,27 @@
 """
 import unittest
 
-from zope.app.dav.globaldavschemaservice import davSchemaService
-from zope.app.interfaces.component import IDAVSchemaService
-from zope.app.services.servicenames import DAVSchema
-from zope.component.service import defineService, serviceManager
-from zope.component.tests.placelesssetup import PlacelessSetup
 from zope.configuration import xmlconfig
 from zope.interface import Interface
+
+from zope.app import zapi
+from zope.app.services.servicenames import Utilities
+from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.dav.interfaces import IDAVNamespace
 import zope.app.dav.tests
 
+ns = 'http://www.zope3.org/dav-schema'
+
 class ISchema(Interface):
     pass
 
 class DirectivesTest(PlacelessSetup, unittest.TestCase):
 
-    def setUp(self):
-        super(DirectivesTest, self).setUp()
-        defineService(DAVSchema, IDAVSchemaService)
-        serviceManager.provideService(DAVSchema, davSchemaService)
-
     def test_provideInterface(self):
-        self.assertEqual(davSchemaService.queryNamespace(ISchema), None)
+        utils = zapi.getService(None, Utilities)
+        self.assertEqual(utils.queryUtility(IDAVNamespace, name=ns), None)
         self.context = xmlconfig.file("dav.zcml", zope.app.dav.tests)
-        self.assertEqual(davSchemaService.queryNamespace(ISchema),
-                         'http://www.zope3.org/dav-schema')
+        self.assertEqual(utils.queryUtility(IDAVNamespace, name=ns), ISchema)
 
 def test_suite():
     return unittest.TestSuite((


=== Zope3/src/zope/app/dav/tests/test_propfind.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/dav/tests/test_propfind.py:1.14	Wed Mar  3 05:38:41 2004
+++ Zope3/src/zope/app/dav/tests/test_propfind.py	Wed Mar  3 12:06:31 2004
@@ -14,13 +14,11 @@
 """
 $Id$
 """
-__metaclass__ = type
-
 from StringIO import StringIO
 from unittest import TestCase, TestSuite, main, makeSuite
 from datetime import datetime
 
-from zope.interface import implements
+from zope.interface import implements, directlyProvides
 from zope.component import getView, getAdapter
 from zope.publisher.interfaces.http import IHTTPRequest
 from zope.pagetemplate.tests.util import normalize_xml
@@ -42,9 +40,8 @@
 from zope.app.attributeannotations import AttributeAnnotations
 
 from zope.app.dav import propfind
-from zope.app.interfaces.dav import IDAVSchema
+from zope.app.dav.interfaces import IDAVSchema, IDAVNamespace
 from zope.app.dav.widget import TextDAVWidget, SequenceDAVWidget
-from zope.app.dav.globaldavschemaservice import provideInterface
 
 import zope.app.location
 
@@ -147,9 +144,14 @@
         ztapi.setDefaultViewName(IDatetime, 'view')
         ztapi.setDefaultViewName(ISequence, 'view')
         ztapi.provideAdapter(IAnnotatable, IAnnotations, AttributeAnnotations)
-        ztapi.provideAdapter(IAnnotatable, IZopeDublinCore, ZDCAnnotatableAdapter)
-        provideInterface('DAV:', IDAVSchema)
-        provideInterface('http://www.purl.org/dc/1.1', IZopeDublinCore)
+        ztapi.provideAdapter(IAnnotatable, IZopeDublinCore,
+                             ZDCAnnotatableAdapter)
+        utils = zapi.getService(None, 'Utilities')
+        directlyProvides(IDAVSchema, IDAVNamespace)
+        utils.provideUtility(IDAVNamespace, IDAVSchema, 'DAV:')
+        directlyProvides(IZopeDublinCore, IDAVNamespace)
+        utils.provideUtility(IDAVNamespace, IZopeDublinCore,
+                             'http://www.purl.org/dc/1.1')
 
     def test_contenttype1(self):
         file = self.file

=== Removed File Zope3/src/zope/app/dav/tests/test_davschemaservice.py ===




More information about the Zope3-Checkins mailing list