[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ *
src/zope/app/utility/browser/ftests.py
Fred L. Drake, Jr.
fdrake at gmail.com
Tue Aug 24 14:39:32 EDT 2004
Log message for revision 27250:
* src/zope/app/utility/browser/ftests.py
- new functional test of the Utility service contents view
* src/zope/app/utility/configure.zcml
- cleaned up security declarations for LocalUtilityService
- added missing security declarations
* src/zope/app/securitypolicy/configure.zcml
- added missing security declarations for RoleRegistration
* src/zope/app/registration/browser/__init__.py
- fixed typo (zpi -> zapi)
* src/zope/app/registration/configure.zcml
- added missing security declarations for NotifyingRegistrationStack
* src/zope/app/registration/interfaces.py
- added missing attribute to IComponentRegistration
- added note that ".component" is preferred over ".getComponent()"
Changed:
U Zope3/trunk/src/zope/app/registration/browser/__init__.py
U Zope3/trunk/src/zope/app/registration/configure.zcml
U Zope3/trunk/src/zope/app/registration/interfaces.py
U Zope3/trunk/src/zope/app/securitypolicy/configure.zcml
A Zope3/trunk/src/zope/app/utility/browser/ftests.py
U Zope3/trunk/src/zope/app/utility/configure.zcml
-=-
Modified: Zope3/trunk/src/zope/app/registration/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/browser/__init__.py 2004-08-24 17:56:37 UTC (rev 27249)
+++ Zope3/trunk/src/zope/app/registration/browser/__init__.py 2004-08-24 18:39:31 UTC (rev 27250)
@@ -140,7 +140,7 @@
reg = info['registration']
info['summary'] = reg.implementationSummary()
- info['id'] = zpi.getPath(reg)
+ info['id'] = zapi.getPath(reg)
# Add a dummy registration since the stack removes trailing None.
registrations.append({"active": False,
Modified: Zope3/trunk/src/zope/app/registration/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/registration/configure.zcml 2004-08-24 17:56:37 UTC (rev 27249)
+++ Zope3/trunk/src/zope/app/registration/configure.zcml 2004-08-24 18:39:31 UTC (rev 27250)
@@ -11,6 +11,13 @@
/>
</content>
+ <content class=".registration.NotifyingRegistrationStack">
+ <require
+ permission="zope.ManageServices"
+ interface=".interfaces.IRegistrationStack"
+ />
+ </content>
+
<adapter
for=".interfaces.IRegisterable"
provides=".interfaces.IRegistered"
Modified: Zope3/trunk/src/zope/app/registration/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/registration/interfaces.py 2004-08-24 17:56:37 UTC (rev 27249)
+++ Zope3/trunk/src/zope/app/registration/interfaces.py 2004-08-24 18:39:31 UTC (rev 27250)
@@ -129,9 +129,14 @@
def getComponent():
"""Return the component named in the registration.
+
+ This is provided for backward compatibility; please use the
+ `component` attribute instead.
"""
+ component = Attribute(_("the component named in the registration"))
+
class IRegistrationStack(Interface):
"""A stack of registrations for a set of parameters
Modified: Zope3/trunk/src/zope/app/securitypolicy/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/configure.zcml 2004-08-24 17:56:37 UTC (rev 27249)
+++ Zope3/trunk/src/zope/app/securitypolicy/configure.zcml 2004-08-24 18:39:31 UTC (rev 27250)
@@ -77,6 +77,7 @@
<content class=".role.RoleRegistration">
<require
permission="zope.ManageServices"
+ attributes="required with provided factory"
interface="zope.app.utility.interfaces.IUtilityRegistration"
set_schema="zope.app.utility.interfaces.IUtilityRegistration" />
</content>
Added: Zope3/trunk/src/zope/app/utility/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/utility/browser/ftests.py 2004-08-24 17:56:37 UTC (rev 27249)
+++ Zope3/trunk/src/zope/app/utility/browser/ftests.py 2004-08-24 18:39:31 UTC (rev 27250)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Tests for zope.app.utility.browser."""
+
+import unittest
+
+import transaction
+
+import zope.app.securitypolicy.interfaces
+import zope.app.securitypolicy.role
+
+from zope.app import zapi
+
+from zope.app.tests import functional
+
+
+class UtilityViewTestCase(functional.BrowserTestCase):
+
+ def test_utilities_view(self):
+ # need to add and activate a role utility
+ root = self.getRootFolder()
+ default = zapi.traverse(root, "/++etc++site/default")
+ role = zope.app.securitypolicy.role.PersistentRole("my-sample-role")
+ default["my-role"] = role
+ reg = zope.app.securitypolicy.role.RoleRegistration(
+ "my-role-registration",
+ zope.app.securitypolicy.interfaces.IRole,
+ "my-role")
+ rm = default.getRegistrationManager()
+ rm.addRegistration(reg)
+ reg.status = "Active"
+ transaction.get_transaction().commit()
+ # now let's take a look at the Utilities page:
+ response = self.publish(
+ "/++etc++site/default/Utilities/@@utilities.html",
+ basic="mgr:mgrpw")
+ self.assertEqual(response.getStatus(), 200)
+
+
+def test_suite():
+ return unittest.makeSuite(UtilityViewTestCase)
+
+if __name__ == "__main__":
+ unittest.main(defaultTest="test_suite")
Property changes on: Zope3/trunk/src/zope/app/utility/browser/ftests.py
___________________________________________________________________
Name: svn:mime-type
+ text/x-python
Name: svn:eol-style
+ native
Modified: Zope3/trunk/src/zope/app/utility/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/utility/configure.zcml 2004-08-24 17:56:37 UTC (rev 27249)
+++ Zope3/trunk/src/zope/app/utility/configure.zcml 2004-08-24 18:39:31 UTC (rev 27250)
@@ -7,10 +7,7 @@
<require
permission="zope.ManageServices"
- attributes="queryRegistrations" />
-
- <require
- permission="zope.ManageServices"
+ attributes="queryRegistrations"
interface="zope.app.registration.interfaces.IRegistry" />
</content>
@@ -19,6 +16,7 @@
<require
permission="zope.ManageServices"
+ attributes="required with provided factory"
interface="zope.app.utility.interfaces.IUtilityRegistration"
set_schema="zope.app.utility.interfaces.IUtilityRegistration" />
More information about the Zope3-Checkins
mailing list