[CMF-checkins] CVS: Products/CMFCore/tests -
test_ActionInformation.py:1.10.2.2
Yvo Schubbe
y.2005- at wcm-solutions.de
Tue Jan 25 15:10:25 EST 2005
Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv30450/CMFCore/tests
Modified Files:
Tag: CMF-1_5-branch
test_ActionInformation.py
Log Message:
backported change from HEAD:
- fixed ActionInfo issue regarding permissions in oldstyle action dicts
=== Products/CMFCore/tests/test_ActionInformation.py 1.10.2.1 => 1.10.2.2 ===
--- Products/CMFCore/tests/test_ActionInformation.py:1.10.2.1 Fri Sep 3 13:18:18 2004
+++ Products/CMFCore/tests/test_ActionInformation.py Tue Jan 25 15:10:25 2005
@@ -9,7 +9,9 @@
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 DummySite
from Products.CMFCore.tests.base.dummy import DummyTool as DummyMembershipTool
+from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.tests.base.testcase import TransactionalTest
@@ -68,6 +70,37 @@
self.assertEqual( ai, wanted )
+class ActionInfoSecurityTests(SecurityTest):
+
+ def setUp(self):
+ SecurityTest.setUp(self)
+ self.site = DummySite('site').__of__(self.root)
+ self.site._setObject( 'portal_membership', DummyMembershipTool() )
+
+ def _makeOne(self, *args, **kw):
+ from Products.CMFCore.ActionInformation import ActionInfo
+
+ return ActionInfo(*args, **kw)
+
+ def test_create_from_dict(self):
+ WANTED = {'allowed': True, 'available': True, 'category': 'object',
+ 'id': 'foo', 'name': 'foo', 'permissions': ('View',),
+ 'title': 'foo', 'url': '', 'visible': True}
+
+ action = {'name': 'foo', 'url': '', 'permissions': ('View',)}
+ ec = createExprContext(self.site, self.site, None)
+ ai = self._makeOne(action, ec)
+
+ self.assertEqual( ai['id'], WANTED['id'] )
+ self.assertEqual( ai['title'], WANTED['title'] )
+ self.assertEqual( ai['url'], WANTED['url'] )
+ self.assertEqual( ai['category'], WANTED['category'] )
+ self.assertEqual( ai['visible'], WANTED['visible'] )
+ self.assertEqual( ai['available'], WANTED['available'] )
+ self.assertEqual( ai['allowed'], WANTED['allowed'] )
+ self.assertEqual( ai, WANTED )
+
+
class ActionInformationTests(TransactionalTest):
def setUp( self ):
@@ -164,6 +197,7 @@
def test_suite():
return TestSuite((
makeSuite(ActionInfoTests),
+ makeSuite(ActionInfoSecurityTests),
makeSuite(ActionInformationTests),
))
More information about the CMF-checkins
mailing list