[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture/tests - testDirectives.py:1.1.2.4
Steve Alexander
steve@cat-box.net
Wed, 20 Feb 2002 04:35:21 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture/tests
In directory cvs.zope.org:/tmp/cvs-serv3998/lib/python/Zope/ComponentArchitecture/tests
Modified Files:
Tag: Zope-3x-branch
testDirectives.py
Log Message:
Added test for defaultView directive.
See Collector item number 3:
http://collector.zope.org/Zope3-dev/3
=== Zope3/lib/python/Zope/ComponentArchitecture/tests/testDirectives.py 1.1.2.3 => 1.1.2.4 ===
from cStringIO import StringIO
from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
+from Zope.ComponentArchitecture import getDefaultViewName
template = """<zopeConfigure
xmlns='http://namespaces.zope.org/zope'
@@ -52,6 +53,28 @@
)))
self.assertEqual(getView(ob, 'test', IV, None).__class__, V1)
+
+
+ def testDefaultView(self):
+
+ ob = Ob()
+ self.assertEqual(getView(ob, 'test', IV, None), None)
+
+ xmlconfig(StringIO(template % (
+ """
+ <directive name="defaultView"
+ attributes="component, type, name, for, layer"
+ handler="Zope.ComponentArchitecture.metaConfigure.defaultView"
+ namespace="http://namespaces.zope.org/zope" />
+ <defaultView name="test"
+ factory="Zope.ComponentArchitecture.tests.TestViews.V1"
+ for="Zope.ComponentArchitecture.tests.TestViews.IC"
+ type="Zope.ComponentArchitecture.tests.TestViews.IV"/>
+ """
+ )))
+
+ self.assertEqual(getView(ob, 'test', IV, None).__class__, V1)
+ self.assertEqual(getDefaultViewName(ob, IV), 'test')
def testSKinView(self):