[CMF-checkins] CVS: Products/CMFCore/tests -
test_ActionInformation.py:1.11.6.3
Yvo Schubbe
y.2005- at wcm-solutions.de
Tue Jan 25 13:40:46 EST 2005
Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv3127/CMFCore/tests
Modified Files:
Tag: yuppie-new_actions-branch
test_ActionInformation.py
Log Message:
- added test with permissions check
=== Products/CMFCore/tests/test_ActionInformation.py 1.11.6.2 => 1.11.6.3 ===
--- Products/CMFCore/tests/test_ActionInformation.py:1.11.6.2 Tue Jan 25 11:04:20 2005
+++ Products/CMFCore/tests/test_ActionInformation.py Tue Jan 25 13:40:45 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
@@ -151,6 +153,36 @@
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', '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 ):
@@ -277,6 +309,7 @@
makeSuite(ActionCategoryTests),
makeSuite(ActionTests),
makeSuite(ActionInfoTests),
+ makeSuite(ActionInfoSecurityTests),
makeSuite(ActionInformationTests),
))
More information about the CMF-checkins
mailing list