[CMF-checkins] CVS: CMF/CMFCore/tests -
test_ActionInformation.py:1.5.16.1
test_ActionsTool.py:1.8.32.1 test_Expression.py:1.3.58.1
Yvo Schubbe
cvs-admin at zope.org
Fri Nov 21 14:21:53 EST 2003
Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv22054/CMFCore/tests
Modified Files:
Tag: yuppie-listActionInfos-branch
test_ActionInformation.py test_ActionsTool.py
test_Expression.py
Log Message:
refactoring (part 1):
- added getOAI() and getExprContext() to get computed contexts from REQUEST cache or create new ones
- listFilteredActionsFor() is now using these new methods
- moved Action filtering into _listActionInfos for Action Providers that don't implement the new API
- import and whitespace cleanup
=== CMF/CMFCore/tests/test_ActionInformation.py 1.5 => 1.5.16.1 ===
--- CMF/CMFCore/tests/test_ActionInformation.py:1.5 Fri May 9 17:40:23 2003
+++ CMF/CMFCore/tests/test_ActionInformation.py Fri Nov 21 14:21:52 2003
@@ -7,17 +7,16 @@
# for Zope versions before 2.6.1
pass
-from Products.CMFCore.tests.base.testcase import \
- TransactionalTest
-
-from Products.CMFCore.tests.base.dummy import \
- DummyContent, DummyTool as DummyMembershipTool
-
from Products.CMFCore.ActionInformation import ActionInformation
-from Products.CMFCore.Expression import Expression, createExprContext
+from Products.CMFCore.Expression import createExprContext
+from Products.CMFCore.Expression import Expression
+from Products.CMFCore.tests.base.dummy import DummyContent
+from Products.CMFCore.tests.base.dummy import DummyTool as DummyMembershipTool
+from Products.CMFCore.tests.base.testcase import TransactionalTest
+
class ActionInformationTests(TransactionalTest):
-
+
def setUp( self ):
TransactionalTest.setUp( self )
@@ -58,11 +57,11 @@
self.assertEqual(ai.getVisibility(), 0)
self.assertEqual(ai.getCategory(), 'global')
self.assertEqual(ai.getPermissions(), ())
-
+
def test_Condition(self):
- portal = self.portal
+ portal = self.portal
folder = self.folder
- object = self.object
+ object = self.object
ai = ActionInformation(id='view'
, title='View'
, action=Expression(
@@ -73,7 +72,8 @@
, visible=1)
ec = createExprContext(folder, portal, object)
self.failIf(ai.testCondition(ec))
-
+
+
def test_suite():
return TestSuite((
makeSuite(ActionInformationTests),
=== CMF/CMFCore/tests/test_ActionsTool.py 1.8 => 1.8.32.1 ===
--- CMF/CMFCore/tests/test_ActionsTool.py:1.8 Mon Jan 6 15:40:36 2003
+++ CMF/CMFCore/tests/test_ActionsTool.py Fri Nov 21 14:21:52 2003
@@ -1,7 +1,12 @@
-from unittest import TestCase, TestSuite, makeSuite, main
+from unittest import TestSuite, makeSuite, main
import Zope
try:
+ Zope.startup()
+except AttributeError:
+ # for Zope versions before 2.6.1
+ pass
+try:
from Interface.Verify import verifyClass
except ImportError:
# for Zope versions before 2.6.0
@@ -19,20 +24,20 @@
from Products.CMFCore.RegistrationTool import RegistrationTool
from Products.CMFCore.MembershipTool import MembershipTool
+
class ActionsToolTests( SecurityRequestTest ):
def setUp( self ):
-
+
SecurityRequestTest.setUp(self)
-
+
root = self.root
root._setObject( 'portal_actions', ActionsTool() )
- root._setObject('foo', URLTool() )
- root._setObject('bar', URLTool() )
+ root._setObject( 'portal_url', URLTool() )
+ root._setObject( 'foo', URLTool() )
root._setObject('portal_membership', MembershipTool())
root._setObject('portal_types', TypesTool())
self.tool = root.portal_actions
- self.ut = root.foo
self.tool.action_providers = ('portal_actions',)
def test_actionProviders(self):
@@ -44,10 +49,10 @@
tool.addActionProvider('foo')
self.assertEqual(tool.listActionProviders(),
('portal_actions', 'foo'))
- tool.addActionProvider('bar')
+ tool.addActionProvider('portal_url')
tool.addActionProvider('foo')
self.assertEqual(tool.listActionProviders(),
- ('portal_actions', 'foo', 'bar'))
+ ('portal_actions', 'foo', 'portal_url'))
def test_delActionProvider(self):
tool = self.tool
@@ -75,7 +80,7 @@
'category': 'object'}],
'folder': [],
'global': []})
-
+
def test_listDictionaryActions(self):
"""
Check that listFilteredActionsFor works for objects
=== CMF/CMFCore/tests/test_Expression.py 1.3 => 1.3.58.1 ===
--- CMF/CMFCore/tests/test_Expression.py:1.3 Fri Feb 15 14:45:33 2002
+++ CMF/CMFCore/tests/test_Expression.py Fri Nov 21 14:21:52 2003
@@ -1,19 +1,24 @@
-import Zope
from unittest import TestSuite, makeSuite, main
-from Products.CMFCore.tests.base.testcase import \
- SecurityTest
-
-from Products.CMFCore.tests.base.dummy import \
- DummyContent, DummyTool as DummyMembershipTool
+import Zope
+try:
+ Zope.startup()
+except AttributeError:
+ # for Zope versions before 2.6.1
+ pass
from Products.CMFCore.ActionInformation import ActionInformation
-from Products.CMFCore.Expression import Expression, createExprContext
+from Products.CMFCore.Expression import createExprContext
+from Products.CMFCore.Expression import Expression
+from Products.CMFCore.tests.base.dummy import DummyContent
+from Products.CMFCore.tests.base.dummy import DummyTool as DummyMembershipTool
+from Products.CMFCore.tests.base.testcase import SecurityTest
+
class ExpressionTests( SecurityTest ):
def setUp( self ):
-
+
SecurityTest.setUp(self)
root = self.root
root._setObject('portal', DummyContent('portal', url='url_portal'))
@@ -57,7 +62,8 @@
self.failUnless(folder)
self.assertEqual(folder.id, 'foo')
self.assertEqual(folder.absolute_url(), 'url_foo')
-
+
+
def test_suite():
return TestSuite((
makeSuite(ExpressionTests),
More information about the CMF-checkins
mailing list