[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests -
test_configure.py:1.3 test_directives.py:1.6
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Mar 8 07:07:06 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv13053/src/zope/app/browser/form/tests
Modified Files:
test_configure.py test_directives.py
Log Message:
Adjusted code to use the new APIs for permissions and principals. Also, use
the utility service instead of the permission registry to look up permissions.
=== Zope3/src/zope/app/browser/form/tests/test_configure.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/form/tests/test_configure.py:1.2 Mon Jul 28 18:20:22 2003
+++ Zope3/src/zope/app/browser/form/tests/test_configure.py Mon Mar 8 07:05:54 2004
@@ -11,9 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
+"""Test that the package's configure.zcml can be loaded.
-"""Test that the package's configure.zcml can be loaded."""
-
+$Id$
+"""
import unittest
from zope.app.tests.placelesssetup import PlacelessSetup
=== Zope3/src/zope/app/browser/form/tests/test_directives.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/form/tests/test_directives.py:1.5 Fri Mar 5 23:17:18 2004
+++ Zope3/src/zope/app/browser/form/tests/test_directives.py Mon Mar 8 07:05:54 2004
@@ -11,7 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
+"""Form Directives Tests
+$Id$
+"""
import os
import unittest
from cStringIO import StringIO
@@ -20,7 +23,6 @@
from zope.interface import Interface, implements
from zope.configuration.xmlconfig import xmlconfig, XMLConfig
-from zope.component import queryView
from zope.component import getDefaultViewName, getResource
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.security.proxy import ProxyFactory
@@ -30,9 +32,6 @@
from zope.publisher.browser import TestRequest
import zope.app.publisher.browser
-from zope.app.interfaces.security import IPermissionService
-from zope.app.security.registries.permissionregistry import permissionRegistry
-from zope.component.service import serviceManager
from zope.schema import TextLine
@@ -55,8 +54,7 @@
text = TextLine(
title=u'Text',
description=u'Nice text',
- required=False,
- )
+ required=False)
class IC(Schema): pass
@@ -85,7 +83,7 @@
ps.defineUsage("overridden")
def testEditForm(self):
- self.assertEqual(queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryView(ob, 'test', request),
None)
xmlconfig(StringIO(template % ("""
<view
@@ -105,13 +103,13 @@
permission="zope.Public" />
""")))
- v = queryView(ob, 'edit.html', request)
+ v = zapi.queryView(ob, 'edit.html', request)
# expect component lookup as standard macros are not configured
self.assertRaises(ComponentLookupError, v)
def testEditFormWithMenu(self):
- self.assertEqual(queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryView(ob, 'test', request),
None)
xmlconfig(StringIO(template % ("""
<browser:menu id="test_menu" title="Test menu" usage="objectview"/>
@@ -134,13 +132,13 @@
/>
""")))
- v = queryView(ob, 'edit.html', request)
+ v = zapi.queryView(ob, 'edit.html', request)
self.assertEqual(v.usage, 'objectview')
# expect component lookup as standard macros are not configured
self.assertRaises(ComponentLookupError, v)
def testEditFormWithUsage(self):
- self.assertEqual(queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryView(ob, 'test', request),
None)
xmlconfig(StringIO(template % ("""
<view
@@ -161,14 +159,14 @@
/>
""")))
- v = queryView(ob, 'edit.html', request)
+ v = zapi.queryView(ob, 'edit.html', request)
self.assertEqual(v.usage, 'objectview')
# expect component lookup as standard macros are not configured
self.assertRaises(ComponentLookupError, v)
def testEditFormWithMenuAndUsage(self):
- self.assertEqual(queryView(ob, 'test', request),
+ self.assertEqual(zapi.queryView(ob, 'test', request),
None)
xmlconfig(StringIO(template % ("""
<browser:menu id="test_menu" title="Test menu" usage="overridden"/>
@@ -192,7 +190,7 @@
/>
""")))
- v = queryView(ob, 'edit.html', request)
+ v = zapi.queryView(ob, 'edit.html', request)
self.assertEqual(v.usage, 'objectview')
# expect component lookup as standard macros are not configured
self.assertRaises(ComponentLookupError, v)
More information about the Zope3-Checkins
mailing list