[Zope3-checkins] CVS: Zope3/src/zope/app/dav/tests - dav.zcml:1.1 test_directives.py:1.1 test_davschemaservice.py:1.3 test_mkcol.py:1.2

Stephan Richter srichter@cosmos.phy.tufts.edu
Sat, 2 Aug 2003 13:26:21 -0400


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

Modified Files:
	test_davschemaservice.py test_mkcol.py 
Added Files:
	dav.zcml test_directives.py 
Log Message:
Implemented the 'dav' namepsace in the new ZCML style and added a directive
test.

Also converted zope/app/configure.zcml to new style.


=== Added File Zope3/src/zope/app/dav/tests/dav.zcml ===
<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:dav="http://namespaces.zope.org/dav">

  <include package="zope.app.dav" file="meta.zcml"/>

  <dav:provideInterface 
      for="http://www.zope3.org/dav-schema"
      interface=".test_directives.ISchema" />
 
</configure>


=== Added File Zope3/src/zope/app/dav/tests/test_directives.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test the wiki ZCML namespace directives.

$Id: test_directives.py,v 1.1 2003/08/02 17:26:15 srichter Exp $
"""
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
import zope.app.dav.tests

  
class ISchema(Interface):
    pass


class DirectivesTest(PlacelessSetup, unittest.TestCase):

    def setUp(self):
        PlacelessSetup.setUp(self)
        defineService(DAVSchema, IDAVSchemaService)
        serviceManager.provideService(DAVSchema, davSchemaService)

    def test_provideInterface(self):
        self.assertEqual(davSchemaService.queryNamespace(ISchema), None)
        self.context = xmlconfig.file("dav.zcml", zope.app.dav.tests)
        self.assertEqual(davSchemaService.queryNamespace(ISchema),
                         'http://www.zope3.org/dav-schema')


def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(DirectivesTest),
        ))

if __name__ == '__main__':
    unittest.main()


=== Zope3/src/zope/app/dav/tests/test_davschemaservice.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/dav/tests/test_davschemaservice.py:1.2	Tue May 20 15:43:27 2003
+++ Zope3/src/zope/app/dav/tests/test_davschemaservice.py	Sat Aug  2 13:26:15 2003
@@ -11,6 +11,10 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
+"""DAV Schema Service Tests
+
+$Id$
+"""
 from zope.interface import Interface
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.testing.cleanup import CleanUp
@@ -23,25 +27,22 @@
     pass
 
 class I(Interface):
-    """bah blah
-    """
+    pass
 
 class I2(B):
-    """eek
-    """
+    """eek"""
 
 class I3(B):
-    """
-    """
+
     def one():
         """method one"""
 
     def two():
         """method two"""
 
+
 class Test(CleanUp, TestCase):
-    """Test Interface for DAVSchemaService Instance.
-    """
+    """Test Interface for DAVSchemaService Instance"""
 
     def testInterfaceVerification(self):
 
@@ -52,14 +53,18 @@
 
         self.assertRaises(ComponentLookupError,
                           service.getInterface, 'http://www.foo.bar/boxschema/')
-        self.assertEqual(service.queryInterface('http://www.foo.bar/boxschema/'), None)
-        self.assertEqual(service.queryInterface('http://www.foo.bar/boxschema/', 42), 42)
+        self.assertEqual(
+            service.queryInterface('http://www.foo.bar/boxschema/'), None)
+        self.assertEqual(
+            service.queryInterface('http://www.foo.bar/boxschema/', 42), 42)
         self.failIf(service.searchInterface(''))
 
         service.provideInterface('http://www.foo.bar/boxschema/', I)
 
-        self.assertEqual(service.getInterface('http://www.foo.bar/boxschema/'), I)
-        self.assertEqual(service.queryInterface('http://www.foo.bar/boxschema/'), I)
+        self.assertEqual(
+            service.getInterface('http://www.foo.bar/boxschema/'), I)
+        self.assertEqual(
+            service.queryInterface('http://www.foo.bar/boxschema/'), I)
         self.assertEqual(list(service.searchInterface('')), [I])
         self.assertEqual(list(service.searchInterface(base=B)), [])
 
@@ -72,8 +77,10 @@
         self.assertEqual(list(service.searchInterface('I2')), [I2])
         self.assertEqual(list(service.searchInterface('eek')), [I2])
 
-        self.assertEqual(list(service.searchInterfaceIds('I2')), ['http://www.foo.bag/boxschema/'])
-        self.assertEqual(list(service.searchInterfaceIds('eek')), ['http://www.foo.bag/boxschema/'])
+        self.assertEqual(list(service.searchInterfaceIds('I2')),
+                         ['http://www.foo.bag/boxschema/'])
+        self.assertEqual(list(service.searchInterfaceIds('eek')),
+                         ['http://www.foo.bag/boxschema/'])
 
         service.provideInterface('http://www.foo.baz/boxschema/', I3)
         self.assertEqual(list(service.searchInterface('two')), [I3])
@@ -91,13 +98,6 @@
 
         ns = service.queryNamespace(I3, '')
         self.assertEqual(ns, 'http://www.foo.baz/boxschema/')
-
-def test_suite():
-    return TestSuite((makeSuite(Test),))
-
-if __name__=='__main__':
-    main(defaultTest='test_suite')
-    self.assertEqual(list(service.searchInterface('two')), [I3])
 
 
 def test_suite():


=== Zope3/src/zope/app/dav/tests/test_mkcol.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/dav/tests/test_mkcol.py:1.1	Mon Jun 23 13:21:09 2003
+++ Zope3/src/zope/app/dav/tests/test_mkcol.py	Sat Aug  2 13:26:15 2003
@@ -11,7 +11,8 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""
+"""MKCOL tests
+
 $Id$
 """
 __metaclass__ = type