Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
CMFCore.tests.test_ActionInformation.ActionInformationTests Class Reference
Inheritance diagram for CMFCore.tests.test_ActionInformation.ActionInformationTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.tests.test_ActionInformation.ActionInformationTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def test_z3interfaces
def test_basic_construction
def test_editing
def test_setActionExpression_with_string_prefix
def test_construction_with_Expressions
def test_Condition
def test_Condition_PathExpression
def test_getInfoData_empty
def test_getInfoData_normal

Public Attributes

 portal
 folder
 object

Static Public Attributes

 layer = FunctionalZCMLLayer

Private Member Functions

def _makeOne

Detailed Description

Definition at line 323 of file test_ActionInformation.py.


Member Function Documentation

def CMFCore.tests.test_ActionInformation.ActionInformationTests._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 337 of file test_ActionInformation.py.

00337 
00338     def _makeOne(self, *args, **kw):
00339         from Products.CMFCore.ActionInformation import ActionInformation
00340 
00341         return ActionInformation(*args, **kw)

Definition at line 327 of file test_ActionInformation.py.

00327 
00328     def setUp(self):
00329         TransactionalTest.setUp(self)
00330 
00331         root = self.root
00332         root._setObject('portal', DummyContent('portal', 'url_portal'))
00333         portal = self.portal = root.portal
00334         portal.portal_membership = DummyMembershipTool()
00335         self.folder = DummyContent('foo', 'url_foo')
00336         self.object = DummyContent('bar', 'url_bar')

Definition at line 349 of file test_ActionInformation.py.

00349 
00350     def test_basic_construction(self):
00351         ai = self._makeOne(id='view')
00352 
00353         self.assertEqual(ai.getId(), 'view')
00354         self.assertEqual(ai.Title(), 'view')
00355         self.assertEqual(ai.Description(), '')
00356         self.assertEqual(ai.getCondition(), '')
00357         self.assertEqual(ai.getActionExpression(), '')
00358         self.assertEqual(ai.getVisibility(), 1)
00359         self.assertEqual(ai.getCategory(), 'object')
00360         self.assertEqual(ai.getPermissions(), ())

Here is the call graph for this function:

Definition at line 398 of file test_ActionInformation.py.

00398 
00399     def test_Condition(self):
00400         portal = self.portal
00401         folder = self.folder
00402         object = self.object
00403         ai = self._makeOne( id='view',
00404                             title='View',
00405                             action=Expression(text='view'),
00406                             condition=Expression(text='member'),
00407                             category='global',
00408                             visible=True )
00409         ec = createExprContext(folder, portal, object)
00410 
00411         self.failIf(ai.testCondition(ec))

Here is the call graph for this function:

Definition at line 412 of file test_ActionInformation.py.

00412 
00413     def test_Condition_PathExpression(self):
00414         portal = self.portal
00415         folder = self.folder
00416         object = self.object
00417         manage_addPythonScript(self.root, 'test_script')
00418         script = self.root.test_script
00419         script.ZPythonScript_edit('', 'return context.getId()')
00420         ai = self._makeOne( id='view',
00421                             title='View',
00422                             action=Expression(text='view'),
00423                             condition=Expression(text='portal/test_script'),
00424                             category='global',
00425                             visible=True )
00426         ec = createExprContext(folder, portal, object)
00427 
00428         self.failUnless(ai.testCondition(ec))

Here is the call graph for this function:

Definition at line 381 of file test_ActionInformation.py.

00381 
00382     def test_construction_with_Expressions(self):
00383         ai = self._makeOne( id='view',
00384                             title='View',
00385                             action=Expression(text='view'),
00386                             condition=Expression(text='member'),
00387                             category='global',
00388                             visible=False )
00389 
00390         self.assertEqual(ai.getId(), 'view')
00391         self.assertEqual(ai.Title(), 'View')
00392         self.assertEqual(ai.Description(), '')
00393         self.assertEqual(ai.getCondition(), 'member')
00394         self.assertEqual(ai.getActionExpression(), 'string:${object_url}/view')
00395         self.assertEqual(ai.getVisibility(), 0)
00396         self.assertEqual(ai.getCategory(), 'global')
00397         self.assertEqual(ai.getPermissions(), ())

Here is the call graph for this function:

Definition at line 361 of file test_ActionInformation.py.

00361 
00362     def test_editing(self):
00363         ai = self._makeOne(id='view', category='folder')
00364         ai.edit(id='new_id', title='blah')
00365 
00366         self.assertEqual(ai.getId(), 'new_id')
00367         self.assertEqual(ai.Title(), 'blah')
00368         self.assertEqual(ai.Description(), '')
00369         self.assertEqual(ai.getCondition(), '')
00370         self.assertEqual(ai.getActionExpression(), '')
00371         self.assertEqual(ai.getVisibility(), 1)
00372         self.assertEqual(ai.getCategory(), 'folder')
00373         self.assertEqual(ai.getPermissions(), ())

Here is the call graph for this function:

Definition at line 429 of file test_ActionInformation.py.

00429 
00430     def test_getInfoData_empty(self):
00431         WANTED = ( {'available': True, 'category': 'object',
00432                     'description': '', 'id': 'foo', 'permissions': (),
00433                     'title': 'foo', 'url': '', 'visible': True}, [] )
00434         a = self._makeOne('foo')
00435         self.assertEqual( a.getInfoData(), WANTED )

Here is the call graph for this function:

Definition at line 436 of file test_ActionInformation.py.

00436 
00437     def test_getInfoData_normal(self):
00438         a = self._makeOne('foo',
00439                           title='Foo Title',
00440                           description='Foo description.',
00441                           action='string:${object_url}/foo_url',
00442                           condition='',
00443                           permissions=('View',),
00444                           visible=False)
00445         WANTED = ( {'available': True, 'category': 'object',
00446                     'description': 'Foo description.', 'id': 'foo',
00447                     'permissions': ('View',), 'title': 'Foo Title',
00448                     'url': a._getActionObject(), 'visible': False},
00449                    ['url'] )
00450         self.assertEqual( a.getInfoData(), WANTED )
00451 

Here is the call graph for this function:

Definition at line 374 of file test_ActionInformation.py.

00374 
00375     def test_setActionExpression_with_string_prefix(self):
00376         from Products.CMFCore.Expression import Expression
00377         ai = self._makeOne(id='view', category='folder')
00378         ai.setActionExpression('string:blah')
00379         self.failUnless(isinstance(ai.action,Expression))
00380         self.assertEqual(ai.getActionExpression(), 'string:blah')

Here is the call graph for this function:

Definition at line 342 of file test_ActionInformation.py.

00342 
00343     def test_z3interfaces(self):
00344         from zope.interface.verify import verifyClass
00345         from Products.CMFCore.ActionInformation import ActionInformation
00346         from Products.CMFCore.interfaces import IAction
00347 
00348         verifyClass(IAction, ActionInformation)


Member Data Documentation

Definition at line 334 of file test_ActionInformation.py.

Definition at line 325 of file test_ActionInformation.py.

Definition at line 335 of file test_ActionInformation.py.

Definition at line 332 of file test_ActionInformation.py.


The documentation for this class was generated from the following file: