[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser/tests - test_directives.py:1.1.2.4 test_fileresource.py:1.1.2.3 test_globalbrowsermenuservice.py:1.1.2.2 test_globalbrowsermenuservicedirectives.py:1.1.2.4 test_icondirective.py:1.1.2.4 test_resources.py:1.1.2.2
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:42 -0500
Update of /cvs-repository/Zope3/src/zope/app/publisher/browser/tests
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/app/publisher/browser/tests
Modified Files:
Tag: NameGeddon-branch
test_directives.py test_fileresource.py
test_globalbrowsermenuservice.py
test_globalbrowsermenuservicedirectives.py
test_icondirective.py test_resources.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/app/publisher/browser/tests/test_directives.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_directives.py:1.1.2.3 Tue Dec 24 12:37:57 2002
+++ Zope3/src/zope/app/publisher/browser/tests/test_directives.py Tue Dec 24 21:20:41 2002
@@ -2,14 +2,14 @@
#
# 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.
-#
+#
##############################################################################
import os
@@ -80,14 +80,14 @@
"""
<browser:view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC" />
+ for="zope.component.tests.views.IC" />
"""
- )))
-
+ )))
+
self.assertEqual(
queryView(ob, 'test', request).__class__,
V1)
-
+
def testDefaultView(self):
self.assertEqual(queryView(ob, 'test', request,
None), None)
@@ -96,17 +96,17 @@
"""
<browser:defaultView name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC" />
+ for="zope.component.tests.views.IC" />
"""
- )))
+ )))
self.assertEqual(queryView(ob, 'test',
request, None
).__class__, V1)
self.assertEqual(getDefaultViewName(ob, request
), 'test')
-
-
+
+
def testSkinView(self):
self.assertEqual(queryView(ob, 'test', request,
None), None)
@@ -116,14 +116,14 @@
<browser:skin name="zmi" layers="zmi default" />
<browser:view name="test"
factory="zope.component.tests.views.VZMI"
- layer="zmi"
- for="zope.component.tests.views.IC" />
+ layer="zmi"
+ for="zope.component.tests.views.IC" />
<browser:view name="test"
factory="zope.component.tests.views.V1"
for="zope.component.tests.views.IC" />
"""
- )))
-
+ )))
+
self.assertEqual(
queryView(ob, 'test', request).__class__,
V1)
@@ -140,9 +140,9 @@
xmlconfig(StringIO(template % (
"""
<browser:resource name="test"
- factory="zope.component.tests.views.R1" />
+ factory="zope.component.tests.views.R1" />
"""
- )))
+ )))
self.assertEqual(
queryResource(ob, 'test', request).__class__,
@@ -205,12 +205,12 @@
<browser:skin name="zmi" layers="zmi default" />
<browser:resource name="test"
factory="zope.component.tests.views.RZMI"
- layer="zmi" />
+ layer="zmi" />
<browser:resource name="test"
factory="zope.component.tests.views.R1" />
"""
- )))
-
+ )))
+
self.assertEqual(
queryResource(ob, 'test', request).__class__,
R1)
@@ -225,10 +225,10 @@
"""
<browser:view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
permission="zope.Public"
allowed_interface="zope.component.tests.views.IV"
- />
+ />
"""
))
@@ -242,10 +242,10 @@
"""
<browser:view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
permission="zope.Public"
allowed_attributes="action"
- />
+ />
"""
))
@@ -259,11 +259,11 @@
"""
<browser:view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
permission="zope.Public"
allowed_attributes="action"
allowed_interface="zope.component.tests.views.IV"
- />
+ />
"""
))
@@ -276,11 +276,11 @@
"""
<browser:view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
permission="zope.Public"
allowed_attributes="action index"
allowed_interface="zope.component.tests.views.IV"
- />
+ />
"""
))
@@ -296,9 +296,9 @@
"""
<browser:view name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
allowed_attributes="action index"
- />
+ />
"""
))
@@ -313,9 +313,9 @@
factory="zope.component.tests.views.V1"
for="zope.component.tests.views.IC">
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
- <browser:page name="test.html" template="%s" />
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
+ <browser:page name="test.html" template="%s" />
</browser:view>
""" % test3
))
@@ -337,8 +337,8 @@
factory="zope.app.publisher.browser.tests.test_directives.VT"
for="zope.component.tests.views.IC">
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
</browser:view>
"""
))
@@ -369,9 +369,9 @@
factory="zope.component.tests.views.V1"
for="zope.component.tests.views.IC">
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
- <browser:page name="test.html" template="%s" />
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
+ <browser:page name="test.html" template="%s" />
</browser:view>
""" % test3
))
@@ -403,9 +403,9 @@
for="zope.component.tests.views.IC">
<browser:defaultPage name="test.html" />
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
- <browser:page name="test.html" template="%s" />
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
+ <browser:page name="test.html" template="%s" />
</browser:view>
""" % test3
))
@@ -442,12 +442,12 @@
<browser:view
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
permission="XXX">
- <browser:page name="index.html" attribute="index" />
+ <browser:page name="index.html" attribute="index" />
<browser:page name="action.html" attribute="action"
- permission="zope.Public" />
+ permission="zope.Public" />
</browser:view>
"""
))
@@ -480,12 +480,12 @@
<browser:view
name="test"
factory="zope.component.tests.views.V1"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
permission="zope.Public">
- <browser:page name="index.html" attribute="index" />
+ <browser:page name="index.html" attribute="index" />
<browser:page name="action.html" attribute="action"
- permission="XXX" />
+ permission="XXX" />
</browser:view>
"""
))
@@ -497,12 +497,12 @@
view = getView(ob, 'test', request)
self.assertEqual(view.browserDefault(request)[1], (u'index.html', ))
-
+
v = view.publishTraverse(request, 'index.html')
self.assertEqual(v(), 'V1 here')
v = view.publishTraverse(request, 'action.html')
self.assertRaises(Exception, v)
-
+
def testSkinnedPageView(self):
self.assertEqual(queryView(ob, 'test', request), None)
@@ -512,9 +512,9 @@
<browser:view
factory="zope.component.tests.views.V1">
- <browser:page name="index.html" attribute="index" />
+ <browser:page name="index.html" attribute="index" />
<browser:page name="index.html" attribute="action"
- layer="layer"/>
+ layer="layer"/>
</browser:view>
"""
))
@@ -533,8 +533,8 @@
<browser:resource
factory="zope.component.tests.views.R1">
- <browser:page name="index.html" attribute="index" />
- <browser:page name="action.html" attribute="action" />
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
</browser:resource>
"""
))
@@ -547,7 +547,7 @@
def testFile(self):
path = os.path.join(tests_path, 'test.pt')
-
+
self.assertEqual(queryResource(ob, 'test', request),
None)
@@ -567,7 +567,7 @@
def testtemplate(self):
path = os.path.join(tests_path, 'test.pt')
-
+
self.assertEqual(queryView(ob, 'index.html', request),
None)
@@ -585,7 +585,7 @@
def testtemplateWClass(self):
path = os.path.join(tests_path, 'test2.pt')
-
+
self.assertEqual(queryView(ob, 'index.html', request),
None)
@@ -604,7 +604,7 @@
def testProtectedtemplate(self):
path = os.path.join(tests_path, 'test.pt')
-
+
self.assertEqual(queryView(ob, 'test', request),
None)
@@ -641,7 +641,7 @@
# Need to "log someone in" to turn on checks
#from zope.security.securitymanagement import newSecurityManager
#newSecurityManager('someuser')
-
+
v = getView(ob, 'xxx.html', request)
v = ProxyFactory(v)
self.assertRaises(Exception, v)
@@ -649,7 +649,7 @@
v = getView(ob, 'index.html', request)
v = ProxyFactory(v)
self.assertEqual(v().strip(), '<html><body><p>test</p></body></html>')
-
+
def testtemplateNoName(self):
path = os.path.join(tests_path, 'test.pt')
@@ -660,8 +660,8 @@
"""
<browser:view
template="%s"
- for="zope.component.tests.views.IC"
- />
+ for="zope.component.tests.views.IC"
+ />
""" % path
))
@@ -675,7 +675,7 @@
<browser:view
name="index.html"
template="%s"
- for="zope.component.tests.views.IC"
+ for="zope.component.tests.views.IC"
>
<browser:page name="foo.html" attribute="index" />
</browser:view>
@@ -683,7 +683,7 @@
))
-
+
def test_suite():
loader=unittest.TestLoader()
return loader.loadTestsFromTestCase(Test)
=== Zope3/src/zope/app/publisher/browser/tests/test_fileresource.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_fileresource.py:1.1.2.2 Tue Dec 24 07:51:12 2002
+++ Zope3/src/zope/app/publisher/browser/tests/test_fileresource.py Tue Dec 24 21:20:41 2002
@@ -36,7 +36,7 @@
from zope.app.publisher.browser.fileresource import FileResourceFactory
from zope.app.publisher.browser.fileresource import ImageResourceFactory
-import zope.app.publisher.browser.tests as p
+import zope.app.publisher.browser.tests as p
test_directory = os.path.split(p.__file__)[0]
@@ -44,7 +44,7 @@
def setUp(self):
PlacelessSetup.setUp(self)
- provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
+ provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
def testNoTraversal(self):
@@ -100,8 +100,8 @@
response = resource.request.response
self.assertEqual(response.getHeader('Content-Type'), 'image/gif')
-
-
+
+
def test_suite():
return makeSuite(Test)
=== Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py:1.1.2.1 Mon Dec 23 14:32:04 2002
+++ Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py Tue Dec 24 21:20:41 2002
@@ -49,15 +49,15 @@
def __reg(self):
from zope.app.publisher.browser.globalbrowsermenuservice \
import GlobalBrowserMenuService
-
+
r = GlobalBrowserMenuService()
return r
-
+
def testDup(self):
r = self.__reg()
r.menu('test_id', 'test menu')
self.assertRaises(DuplicationError, r.menu, 'test_id', 'test menu')
-
+
def test(self):
r = self.__reg()
r.menu('test_id', 'test menu')
@@ -81,7 +81,7 @@
}
self.assertEqual(list(menu), [d(5), d(6), d(3), d(2), d(1)])
-
+
def test_no_dups(self):
r = self.__reg()
r.menu('test_id', 'test menu')
@@ -105,13 +105,13 @@
'title': "t%s" % n,
'description': "d%s" % n,
'selected': ''}
-
+
self.assertEqual(list(menu), [d(5), d(6), d(3), d(2), d(1)])
-
+
def testEmpty(self):
r = self.__reg()
r.menu('test_id', 'test menu')
- menu = r.getMenu('test_id', X(), TestRequest())
+ menu = r.getMenu('test_id', X(), TestRequest())
self.assertEqual(list(menu), [])
=== Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservicedirectives.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservicedirectives.py:1.1.2.3 Tue Dec 24 12:37:57 2002
+++ Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservicedirectives.py Tue Dec 24 21:20:41 2002
@@ -41,11 +41,11 @@
PlacelessSetup.setUp(self)
XMLConfig('metameta.zcml', zope.configuration)()
XMLConfig('meta.zcml', zope.app.publisher.browser)()
-
+
def test(self):
from zope.app.publisher.browser.globalbrowsermenuservice \
import globalBrowserMenuService
-
+
xmlconfig(StringIO(template % (
"""
<browser:menu id="test_id" title="test menu" />
@@ -99,7 +99,7 @@
'description': "",
'selected': ''
}
-
+
self.assertEqual(list(menu), [d(5), d(6), d(3), d(2), d(1)])
first = globalBrowserMenuService.getFirstMenuItem(
=== Zope3/src/zope/app/publisher/browser/tests/test_icondirective.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_icondirective.py:1.1.2.3 Tue Dec 24 12:37:57 2002
+++ Zope3/src/zope/app/publisher/browser/tests/test_icondirective.py Tue Dec 24 21:20:41 2002
@@ -70,12 +70,12 @@
import zope.app.publisher.browser.tests as p
path = os.path.split(p.__file__)[0]
path = os.path.join(path, 'test.gif')
-
+
xmlconfig(StringIO(template % (
"""
<browser:icon name="zmi_icon"
for="zope.component.tests.views.IC"
- file="%s" />
+ file="%s" />
""" % path
)))
@@ -87,7 +87,7 @@
% rname)
resource = getResource(ob, rname, request)
-
+
# Resources come ready-wrapped from the factory
#resource = ProxyFactory(resource)
@@ -101,17 +101,17 @@
import zope.app.publisher.browser.tests as p
path = os.path.split(p.__file__)[0]
path = os.path.join(path, 'test.gif')
-
+
xmlconfig(StringIO(template % (
"""
<browser:resource name="zmi_icon_res"
- image="%s" />
+ image="%s" />
<browser:icon name="zmi_icon"
for="zope.component.tests.views.IC"
- resource="zmi_icon_res" />
+ resource="zmi_icon_res" />
""" % path
)))
-
+
view = getView(ob, 'zmi_icon', request)
rname = "zmi_icon_res"
self.assertEqual(
@@ -138,11 +138,11 @@
config = StringIO(template % (
"""
<browser:resource name="zmi_icon_res"
- image="%s" />
+ image="%s" />
<browser:icon name="zmi_icon"
for="zope.component.tests.views.IC"
file="%s"
- resource="zmi_icon_res" />
+ resource="zmi_icon_res" />
""" % (path, path)
))
self.assertRaises(ConfigurationError, xmlconfig, config)
@@ -151,7 +151,7 @@
"""
<browser:icon name="zmi_icon"
for="zope.component.tests.views.IC"
- />
+ />
"""
))
self.assertRaises(ConfigurationError, xmlconfig, config)
=== Zope3/src/zope/app/publisher/browser/tests/test_resources.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_resources.py:1.1.2.1 Mon Dec 23 14:32:04 2002
+++ Zope3/src/zope/app/publisher/browser/tests/test_resources.py Tue Dec 24 21:20:41 2002
@@ -34,7 +34,7 @@
def setUp(self):
PlacelessSetup.setUp(self)
- provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
+ provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
def test(self):
@@ -49,18 +49,18 @@
view = Resources(None, request)
resource = view.publishTraverse(request, 'test')
self.assertEqual(resource(), 42)
-
+
def testNotFound(self):
from zope.app.publisher.browser.resources import Resources
from zope.exceptions import NotFoundError
request = TestRequest()
view = Resources(None, request)
- self.assertRaises(NotFoundError,
- view.publishTraverse,
+ self.assertRaises(NotFoundError,
+ view.publishTraverse,
request, 'test'
)
-
-
+
+
def test_suite():
return makeSuite(Test)