[Zope3-checkins]
SVN: Zope3/branches/philikon-simplify-skinning/src/zope/app/publisher/browser/tests/test_directives.py
* Get rid of the code I just put BBB markers on. These tests
are duplicated,
Philipp von Weitershausen
philikon at philikon.de
Tue Feb 21 10:03:39 EST 2006
Log message for revision 41730:
* Get rid of the code I just put BBB markers on. These tests are duplicated,
the deprecated skin and layer directives have doctests of their own.
* Make the other tests not use browser:layer or browser:skin anymore.
Changed:
U Zope3/branches/philikon-simplify-skinning/src/zope/app/publisher/browser/tests/test_directives.py
-=-
Modified: Zope3/branches/philikon-simplify-skinning/src/zope/app/publisher/browser/tests/test_directives.py
===================================================================
--- Zope3/branches/philikon-simplify-skinning/src/zope/app/publisher/browser/tests/test_directives.py 2006-02-21 14:46:49 UTC (rev 41729)
+++ Zope3/branches/philikon-simplify-skinning/src/zope/app/publisher/browser/tests/test_directives.py 2006-02-21 15:03:38 UTC (rev 41730)
@@ -104,19 +104,11 @@
directlyProvides(ITestMenu, IMenuItemType)
-##############################################################################
-# BBB 2006/02/18, to be removed after 12 months
-#
class ITestLayer(IBrowserRequest):
"""Test Layer."""
-import zope.deprecation
-zope.deprecation.__show__.off()
-from zope.publisher.interfaces import ILayer
-zope.deprecation.__show__.on()
-directlyProvides(ITestLayer, ILayer)
-#
-##############################################################################
+class ITestSkin(ITestLayer):
+ """Test Skin."""
class MyResource(object):
@@ -132,36 +124,6 @@
XMLConfig('meta.zcml', zope.app.publisher.browser)()
ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
- ##########################################################################
- #
- # BBB 2006/02/18, to be removed after 12 months
-
- def testLayer(self):
- self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
- None)
- xmlconfig(StringIO(
- template % '<browser:layer name="testlayer" />'
- ))
- testlayer = zapi.getUtility(ILayer, "testlayer")
- import zope.app.layers
- self.assert_(zope.app.layers.testlayer is testlayer)
-
- def testSkin(self):
- self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
- None)
- xmlconfig(StringIO(template % (
- '''
- <browser:layer name="default" />
- <browser:skin name="testskin" layers="default" />
- '''
- )))
- testskin = zapi.getUtility(IBrowserSkinType, "testskin")
- import zope.app.skins
- self.assert_(zope.app.skins.testskin is testskin)
-
- #
- ##########################################################################
-
def testPage(self):
self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
@@ -344,38 +306,45 @@
xmlconfig(StringIO(template % (
'''
- <browser:layer name="zmi" />
- <browser:skin name="zmi" layers="zmi" />
<browser:resource
name="test"
factory="zope.app.component.tests.views.RZMI"
- layer="zmi" />
+ layer="
+ zope.app.publisher.browser.tests.test_directives.ITestLayer"
+ />
<browser:resource
name="test"
- factory="zope.app.component.tests.views.R1" />
+ factory="zope.app.component.tests.views.R1"
+ />
'''
)))
self.assertEqual(
zapi.queryAdapter(request, name='test').__class__, R1)
- zmi = zapi.getUtility(IBrowserSkinType, 'zmi')
self.assertEqual(
- zapi.queryAdapter(TestRequest(skin=zmi), name='test').__class__,
+ zapi.queryAdapter(TestRequest(skin=ITestSkin), name='test').__class__,
RZMI)
def testDefaultSkin(self):
request = TestRequest()
-
self.assertEqual(zapi.queryMultiAdapter((ob, request), name='test'),
None)
+
+ XMLConfig('meta.zcml', zope.app.component)()
xmlconfig(StringIO(template % (
'''
- <browser:layer name="zmi" />
- <browser:skin name="zmi" layers="zmi" />
- <browser:defaultSkin name="zmi" />
- <browser:page name="test"
+ <interface
+ interface="
+ zope.app.publisher.browser.tests.test_directives.ITestSkin"
+ type="zope.publisher.interfaces.browser.IBrowserSkinType"
+ name="Test Skin"
+ />
+ <browser:defaultSkin name="Test Skin" />
+ <browser:page
+ name="test"
class="zope.app.component.tests.views.VZMI"
- layer="zmi"
+ layer="
+ zope.app.publisher.browser.tests.test_directives.ITestLayer"
for="zope.app.component.tests.views.IC"
permission="zope.Public"
attribute="index"
@@ -403,11 +372,10 @@
xmlconfig(StringIO(template % (
'''
- <browser:layer name="zmi" />
- <browser:skin name="zmi" layers="zmi" />
<browser:page name="test"
class="zope.app.component.tests.views.VZMI"
- layer="zmi"
+ layer="
+ zope.app.publisher.browser.tests.test_directives.ITestLayer"
for="zope.app.component.tests.views.IC"
permission="zope.Public"
attribute="index"
@@ -423,8 +391,7 @@
v = zapi.queryMultiAdapter((ob, request), name='test')
self.assert_(issubclass(v.__class__, V1))
- zmi = zapi.getUtility(IBrowserSkinType, 'zmi')
- v = zapi.queryMultiAdapter((ob, TestRequest(skin=zmi)), name='test')
+ v = zapi.queryMultiAdapter((ob, TestRequest(skin=ITestSkin)), name='test')
self.assert_(issubclass(v.__class__, VZMI))
def testI18nResource(self):
@@ -886,23 +853,21 @@
xmlconfig(StringIO(template %
'''
- <browser:layer name="layer" />
- <browser:skin name="skinny" layers="layer" />
<browser:pages
for="*"
class="zope.app.component.tests.views.V1"
permission="zope.Public"
- >
-
+ >
<browser:page name="index.html" attribute="index" />
</browser:pages>
+
<browser:pages
for="*"
class="zope.app.component.tests.views.V1"
- layer="layer"
+ layer="
+ zope.app.publisher.browser.tests.test_directives.ITestLayer"
permission="zope.Public"
>
-
<browser:page name="index.html" attribute="action" />
</browser:pages>
'''
@@ -910,8 +875,7 @@
v = zapi.getMultiAdapter((ob, request), name='index.html')
self.assertEqual(v(), 'V1 here')
- skinny = zapi.getUtility(IBrowserSkinType, 'skinny')
- v = zapi.getMultiAdapter((ob, TestRequest(skin=skinny)),
+ v = zapi.getMultiAdapter((ob, TestRequest(skin=ITestSkin)),
name='index.html')
self.assertEqual(v(), 'done')
@@ -968,20 +932,20 @@
self.assertEqual(zapi.queryAdapter(request, name='test'), None)
path = os.path.join(tests_path, 'testfiles', 'test.pt')
-
xmlconfig(StringIO(template % (
'''
- <browser:layer name="zmi" />
- <browser:skin name="zmi" layers="zmi" />
- <browser:resource name="test" file="%s"
- layer="zmi" />
+ <browser:resource
+ name="test"
+ file="%s"
+ layer="
+ zope.app.publisher.browser.tests.test_directives.ITestLayer"
+ />
''' % path
)))
self.assertEqual(zapi.queryAdapter(request, name='test'), None)
- zmi = zapi.getUtility(IBrowserSkinType, 'zmi')
- r = zapi.getAdapter(TestRequest(skin=zmi), name='test')
+ r = zapi.getAdapter(TestRequest(skin=ITestSkin), name='test')
r = removeSecurityProxy(r)
self.assertEqual(r._testData(), open(path, 'rb').read())
@@ -1017,11 +981,6 @@
title="Test menu"
interface="zope.app.publisher.browser.tests.test_directives.ITestMenu"/>
- <browser:layer
- name="test_layer"
- interface="zope.app.publisher.browser.tests.test_directives.ITestLayer"
- />
-
<browser:page
name="index.html"
permission="zope.Public"
More information about the Zope3-Checkins
mailing list