[CMF-checkins] CVS: Products/CMFCore/tests -
test_ActionInformation.py:1.11.6.2
test_ActionProviderBase.py:1.17.10.1 test_ActionsTool.py:1.17.10.1
Yvo Schubbe
y.2005- at wcm-solutions.de
Tue Jan 25 11:04:21 EST 2005
Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv20915/CMFCore/tests
Modified Files:
Tag: yuppie-new_actions-branch
test_ActionInformation.py test_ActionProviderBase.py
test_ActionsTool.py
Log Message:
- removed deprecated 'name' and 'permissions' keys from ActionInfo
- allowed 'description' key in ActionInfo
- implemented IAction in the oldstyle ActionInformation class and used this interface to simplify ActionInfo
- updated tests
- some import cleanup
=== Products/CMFCore/tests/test_ActionInformation.py 1.11.6.1 => 1.11.6.2 ===
--- Products/CMFCore/tests/test_ActionInformation.py:1.11.6.1 Mon Jan 24 14:31:15 2005
+++ Products/CMFCore/tests/test_ActionInformation.py Tue Jan 25 11:04:20 2005
@@ -95,8 +95,8 @@
from Products.CMFCore.ActionInformation import Action
WANTED = {'allowed': True, 'available': True, 'category': '',
- 'description': '', 'icon': '', 'id': 'foo',
- 'permissions': (), 'title': '', 'url': '', 'visible': True}
+ 'description': '', 'icon': '', 'id': 'foo', 'title': '',
+ 'url': '', 'visible': True}
action = Action(id='foo')
ec = None
@@ -104,8 +104,8 @@
self.assertEqual( ai['id'], WANTED['id'] )
self.assertEqual( ai['title'], WANTED['title'] )
+ self.assertEqual( ai['description'], WANTED['description'] )
self.assertEqual( ai['url'], WANTED['url'] )
- self.assertEqual( ai['permissions'], WANTED['permissions'] )
self.assertEqual( ai['category'], WANTED['category'] )
self.assertEqual( ai['visible'], WANTED['visible'] )
self.assertEqual( ai['available'], WANTED['available'] )
@@ -116,8 +116,8 @@
from Products.CMFCore.ActionInformation import ActionInformation
WANTED = {'allowed': True, 'available': True, 'category': 'object',
- 'id': 'foo', 'name': 'foo', 'permissions': (),
- 'title': 'foo', 'url': '', 'visible': True}
+ 'description': '', 'id': 'foo', 'title': 'foo', 'url': '',
+ 'visible': True}
action = ActionInformation(id='foo')
ec = None
@@ -125,8 +125,8 @@
self.assertEqual( ai['id'], WANTED['id'] )
self.assertEqual( ai['title'], WANTED['title'] )
+ self.assertEqual( ai['description'], WANTED['description'] )
self.assertEqual( ai['url'], WANTED['url'] )
- self.assertEqual( ai['permissions'], WANTED['permissions'] )
self.assertEqual( ai['category'], WANTED['category'] )
self.assertEqual( ai['visible'], WANTED['visible'] )
self.assertEqual( ai['available'], WANTED['available'] )
@@ -135,8 +135,7 @@
def test_create_from_dict(self):
WANTED = {'allowed': True, 'available': True, 'category': 'object',
- 'id': 'foo', 'name': 'foo', 'permissions': (),
- 'title': 'foo', 'url': '', 'visible': True}
+ 'id': 'foo', 'title': 'foo', 'url': '', 'visible': True}
action = {'name': 'foo', 'url': ''}
ec = None
@@ -145,7 +144,6 @@
self.assertEqual( ai['id'], WANTED['id'] )
self.assertEqual( ai['title'], WANTED['title'] )
self.assertEqual( ai['url'], WANTED['url'] )
- self.assertEqual( ai['permissions'], WANTED['permissions'] )
self.assertEqual( ai['category'], WANTED['category'] )
self.assertEqual( ai['visible'], WANTED['visible'] )
self.assertEqual( ai['available'], WANTED['available'] )
@@ -171,6 +169,13 @@
return ActionInformation(*args, **kw)
+ def test_interface(self):
+ from Products.CMFCore.interfaces.portal_actions \
+ import Action as IAction
+ from Products.CMFCore.ActionInformation import ActionInformation
+
+ verifyClass(IAction, ActionInformation)
+
def test_basic_construction(self):
ai = self._makeOne(id='view')
@@ -244,6 +249,27 @@
self.failUnless(ai.testCondition(ec))
+ def test_getInfoData_empty(self):
+ WANTED = ( {'available': True, 'category': 'object',
+ 'description': '', 'id': 'foo', 'permissions': (),
+ 'title': 'foo', 'url': '', 'visible': True}, [] )
+ a = self._makeOne('foo')
+ self.assertEqual( a.getInfoData(), WANTED )
+
+ def test_getInfoData_normal(self):
+ a = self._makeOne('foo',
+ title='Foo Title',
+ description='Foo description.',
+ action='string:${object_url}/foo_url',
+ condition='',
+ permissions=('View',),
+ visible=False)
+ WANTED = ( {'available': True, 'category': 'object',
+ 'description': 'Foo description.', 'id': 'foo',
+ 'permissions': ('View',), 'title': 'Foo Title',
+ 'url': a._getActionObject(), 'visible': False},
+ ['url'] )
+ self.assertEqual( a.getInfoData(), WANTED )
def test_suite():
=== Products/CMFCore/tests/test_ActionProviderBase.py 1.17 => 1.17.10.1 ===
--- Products/CMFCore/tests/test_ActionProviderBase.py:1.17 Mon Jul 26 06:13:14 2004
+++ Products/CMFCore/tests/test_ActionProviderBase.py Tue Jan 25 11:04:20 2005
@@ -211,9 +211,9 @@
self.assertEqual( old_ids, another_ids )
def test_listActionInfos(self):
- wanted = [{'id': 'an_id', 'title': 'A Title', 'name': 'A Title',
- 'url': '', 'permissions': (), 'category': 'object',
- 'visible': False, 'available': True, 'allowed': True}]
+ wanted = [{'id': 'an_id', 'title': 'A Title', 'description': '',
+ 'url': '', 'category': 'object', 'visible': False,
+ 'available': True, 'allowed': True}]
apb = self.site._setObject( 'portal_apb', self._makeProvider(1) )
rval = apb.listActionInfos()
@@ -232,9 +232,9 @@
self.assertRaises(ValueError, apb.getActionObject, 'wrong_format')
def test_getActionInfo(self):
- wanted = {'id': 'an_id', 'title': 'A Title', 'name': 'A Title',
- 'url': '', 'permissions': (), 'category': 'object',
- 'visible': False, 'available': True, 'allowed': True}
+ wanted = {'id': 'an_id', 'title': 'A Title', 'description': '',
+ 'url': '', 'category': 'object', 'visible': False,
+ 'available': True, 'allowed': True}
apb = self.site._setObject( 'portal_apb', self._makeProvider(1) )
rval = apb.getActionInfo( ('object/an_id',) )
=== Products/CMFCore/tests/test_ActionsTool.py 1.17 => 1.17.10.1 ===
--- Products/CMFCore/tests/test_ActionsTool.py:1.17 Mon Jul 26 06:13:14 2004
+++ Products/CMFCore/tests/test_ActionsTool.py Tue Jan 25 11:04:20 2005
@@ -4,11 +4,8 @@
Zope.startup()
from Interface.Verify import verifyClass
-from Products.CMFCore.ActionInformation import ActionInformation
from Products.CMFCore.ActionsTool import ActionsTool
-from Products.CMFCore.Expression import Expression
from Products.CMFCore.MembershipTool import MembershipTool
-from Products.CMFCore.PortalFolder import PortalFolder
from Products.CMFCore.RegistrationTool import RegistrationTool
from Products.CMFCore.tests.base.testcase import SecurityRequestTest
from Products.CMFCore.TypesTool import TypesTool
@@ -63,11 +60,10 @@
{'workflow': [],
'user': [],
'object': [],
- 'folder': [{'permissions': ('List folder contents',),
- 'id': 'folderContents',
+ 'folder': [{'id': 'folderContents',
'url': 'http://foo/folder_contents',
'title': 'Folder contents',
- 'name': 'Folder contents',
+ 'description': '',
'visible': True,
'available': True,
'allowed': True,
More information about the CMF-checkins
mailing list