[Zope3-checkins] CVS: Zope3/src/zope/app/workflow/tests - workflow.zcml:1.1 test_directives.py:1.4

Stephan Richter srichter@cosmos.phy.tufts.edu
Fri, 1 Aug 2003 16:41:11 -0400


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

Modified Files:
	test_directives.py 
Added Files:
	workflow.zcml 
Log Message:
Another ZCML namespace converted. This time 'workflow'.


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

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

  <workflow:importHandler
      interface=".ITestProcessDefinitionA"
      factory=".TestImportHandlerA" />
 
  <workflow:exportHandler
      interface=".ITestProcessDefinitionA"
      factory=".TestExportHandlerA" />

</configure>


=== Zope3/src/zope/app/workflow/tests/test_directives.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/workflow/tests/test_directives.py:1.3	Mon Jul 28 18:20:13 2003
+++ Zope3/src/zope/app/workflow/tests/test_directives.py	Fri Aug  1 16:41:05 2003
@@ -11,16 +11,14 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
+"""Test the workflow ZCML namespace directives.
 
+$Id$
+"""
 import unittest
-from cStringIO import StringIO
 
 from zope.app.tests.placelesssetup import PlacelessSetup
-
-from zope.configuration.xmlconfig import xmlconfig, XMLConfig
-
-import zope.configuration
-import zope.app.workflow
+from zope.configuration import xmlconfig
 
 from zope.app.workflow import globalimportexport
 from zope.app.workflow.tests import directive_helpers
@@ -28,57 +26,28 @@
 gIE = globalimportexport.globalImportExport
 
 
-template = """<zopeConfigure
-   xmlns:test='http://namespaces.zope.org/workflow'>
-   %s
-   </zopeConfigure>"""
-
-
-class Test(PlacelessSetup, unittest.TestCase):
-
+class DirectivesTest(PlacelessSetup, unittest.TestCase):
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        XMLConfig('meta.zcml', zope.app.workflow)()
+        self.context = xmlconfig.file("workflow.zcml", directive_helpers)
 
     def testImportHandler(self):
-
-        xmlconfig(StringIO(template % (
-            """
-            <configure package="zope.app.workflow.tests.directive_helpers">
-              <test:importHandler
-                 interface=".ITestProcessDefinitionA"
-                 factory=".TestImportHandlerA"
-                 />
-            </configure>
-            """
-            )))
-
-        self.assertEqual(directive_helpers.TestImportHandlerA,
-                         gIE._importers.get(directive_helpers.ITestProcessDefinitionA))
+        self.assertEqual(
+            gIE._importers.get(directive_helpers.ITestProcessDefinitionA),
+            directive_helpers.TestImportHandlerA)
 
     def testExportHandler(self):
-
-        xmlconfig(StringIO(template % (
-            """
-            <configure package="zope.app.workflow.tests.directive_helpers">
-              <test:exportHandler
-                  interface=".ITestProcessDefinitionA"
-                  factory=".TestExportHandlerA"
-                  />
-            </configure>
-            """
-            )))
-
-        self.assertEqual(directive_helpers.TestExportHandlerA,
-                         gIE._exporters.get(directive_helpers.ITestProcessDefinitionA))
+        self.assertEqual(
+            gIE._exporters.get(directive_helpers.ITestProcessDefinitionA),
+            directive_helpers.TestExportHandlerA)
 
 
-        
 
 def test_suite():
-    loader=unittest.TestLoader()
-    return loader.loadTestsFromTestCase(Test)
+    return unittest.TestSuite((
+        unittest.makeSuite(DirectivesTest),
+        ))
 
-if __name__=='__main__':
-    unittest.TextTestRunner().run(test_suite())
+if __name__ == '__main__':
+    unittest.main()