[Zope3-checkins] CVS: Zope3/src/zope/app/component/tests - test_contentdirective.py:1.8

Sidnei da Silva sidnei at x3ng.com.br
Tue Aug 5 11:25:31 EDT 2003


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

Modified Files:
	test_contentdirective.py 
Log Message:
Reasonably big batch of changes. Added methods to query factories by interface. Added tests for them. Registered all fields from zope.schema as factories. Added basic tests for that. Made the contentdirective use a dottedname instead of a class as the id when an id is not provided. Cleanspace Whitening here and there.

=== Zope3/src/zope/app/component/tests/test_contentdirective.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/component/tests/test_contentdirective.py:1.7	Mon Aug  4 19:12:48 2003
+++ Zope3/src/zope/app/component/tests/test_contentdirective.py	Tue Aug  5 10:24:57 2003
@@ -19,6 +19,7 @@
 import unittest
 from StringIO import StringIO
 
+from zope.component.exceptions import ComponentLookupError
 from zope.configuration.xmlconfig import xmlconfig, XMLConfig
 from zope.app.tests.placelesssetup import PlacelessSetup
 from zope.security.management import newSecurityManager, system_user
@@ -154,6 +155,25 @@
                        """)
         xmlconfig(f)
         factory = getService(None, Factories).getFactory('Example')
+        self.assertEquals(factory.title, "Example content")
+        self.assertEquals(factory.description, "Example description")
+
+    def testFactoryNoId(self):
+        f = configfile("""
+<permission id="zope.Foo" title="Zope Foo Permission" />
+
+<content class="zope.app.component.tests.exampleclass.ExampleClass">
+    <factory
+      permission="zope.Foo"
+      title="Example content"
+      description="Example description"
+    />
+</content>
+                       """)
+        xmlconfig(f)
+        fservice = getService(None, Factories)
+        self.assertRaises(ComponentLookupError, fservice.getFactory, 'Example')
+        factory = fservice.getFactory('zope.app.component.tests.exampleclass.ExampleClass')
         self.assertEquals(factory.title, "Example content")
         self.assertEquals(factory.description, "Example description")
 




More information about the Zope3-Checkins mailing list