Back to index

plone3  3.1.7
Public Member Functions
plone.app.contentrules.tests.test_action_notify.TestNotifyAction Class Reference
Inheritance diagram for plone.app.contentrules.tests.test_action_notify.TestNotifyAction:
Inheritance graph
[legend]
Collaboration diagram for plone.app.contentrules.tests.test_action_notify.TestNotifyAction:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testRegistered
def testInvokeAddView
def testInvokeEditView
def testExecute

Detailed Description

Definition at line 22 of file test_action_notify.py.


Member Function Documentation

Definition at line 24 of file test_action_notify.py.

00024 
00025     def afterSetUp(self):
00026         self.setRoles(('Manager',))

Here is the call graph for this function:

Definition at line 56 of file test_action_notify.py.

00056 
00057     def testExecute(self): 
00058         e = NotifyAction()
00059         e.message = 'Hello world'
00060         e.message_type = 'info'
00061         
00062         ex = getMultiAdapter((self.folder, e, DummyEvent()), IExecutable)
00063         self.assertEquals(True, ex())
00064         
00065         status = IStatusMessage(self.app.REQUEST)
00066         new_cookies = self.app.REQUEST.RESPONSE.cookies[STATUSMESSAGEKEY]
00067         messages = _decodeCookieValue(new_cookies['value'])
00068         self.assertEquals(1, len(messages))
00069         self.assertEquals('Hello world', messages[0].message)
00070         self.assertEquals('info', messages[0].type)
00071         
        

Here is the call graph for this function:

Definition at line 34 of file test_action_notify.py.

00034 
00035     def testInvokeAddView(self): 
00036         element = getUtility(IRuleAction, name='plone.actions.Notify')
00037         storage = getUtility(IRuleStorage)
00038         storage[u'foo'] = Rule()
00039         rule = self.portal.restrictedTraverse('++rule++foo')
00040         
00041         adding = getMultiAdapter((rule, self.portal.REQUEST), name='+action')
00042         addview = getMultiAdapter((adding, self.portal.REQUEST), name=element.addview)
00043         
00044         addview.createAndAdd(data={'message' : 'Hello world', 'message_type' : 'info'})
00045         
00046         e = rule.actions[0]
00047         self.failUnless(isinstance(e, NotifyAction))
00048         self.assertEquals('Hello world', e.message)
00049         self.assertEquals('info', e.message_type)
    

Definition at line 50 of file test_action_notify.py.

00050 
00051     def testInvokeEditView(self): 
00052         element = getUtility(IRuleAction, name='plone.actions.Notify')
00053         e = NotifyAction()
00054         editview = getMultiAdapter((e, self.folder.REQUEST), name=element.editview)
00055         self.failUnless(isinstance(editview, NotifyEditForm))

Definition at line 27 of file test_action_notify.py.

00027 
00028     def testRegistered(self): 
00029         element = getUtility(IRuleAction, name='plone.actions.Notify')
00030         self.assertEquals('plone.actions.Notify', element.addview)
00031         self.assertEquals('edit', element.editview)
00032         self.assertEquals(None, element.for_)
00033         self.assertEquals(None, element.event)
    

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