From bc1190ded0f6c282276a93a7b9ae2b7e01a22c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 18 Feb 2008 13:58:53 +0000 Subject: [PATCH] test event creation from event and ticket git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19352 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testCRM.py | 43 ++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/product/ERP5/tests/testCRM.py b/product/ERP5/tests/testCRM.py index 39129b35e1..99c0a2fb96 100644 --- a/product/ERP5/tests/testCRM.py +++ b/product/ERP5/tests/testCRM.py @@ -44,8 +44,8 @@ class TestCRM(ERP5TypeTestCase): def getBusinessTemplateList(self): return ('erp5_base', 'erp5_crm',) - def test_CreateRelatedEvent(self): - # test action to create a related event + def test_Event_CreateRelatedEvent(self): + # test action to create a related event from an event for ptype in self.portal.getPortalEventTypeList(): event = self.portal.event_module.newContent( portal_type=ptype) @@ -59,7 +59,7 @@ class TestCRM(ERP5TypeTestCase): new_event = self.portal.event_module._getOb(new_id) self.assertEquals(event, new_event.getCausalityValue()) - def test_CreateRelatedEventUnauthorized(self): + def test_Event_CreateRelatedEventUnauthorized(self): # test that we don't get Unauthorized error when invoking the "Create # Related Event" without add permission on the module event = self.portal.event_module.newContent(portal_type='Letter') @@ -69,7 +69,44 @@ class TestCRM(ERP5TypeTestCase): title='New Title', description='New Desc') + def test_Ticket_CreateRelatedEvent(self): + # test action to create a related event from a ticket + ticket = self.portal.meeting_module.newContent(portal_type='Meeting') + for ptype in self.portal.getPortalEventTypeList(): + # incoming + redirect = ticket.Ticket_newEvent(direction='incoming', + portal_type=ptype, + title='New Title', + description='New Desc') + self.assert_(redirect.startswith('http://nohost/erp5/event_module/')) + new_id = redirect[ + len('http://nohost/erp5/event_module/'):].split('/', 1)[0] + new_event = self.portal.event_module._getOb(new_id) + self.assertEquals(ticket, new_event.getFollowUpValue()) + self.assertEquals('new', new_event.getSimulationState()) + + # outgoing + redirect = ticket.Ticket_newEvent(direction='outgoing', + portal_type=ptype, + title='New Title', + description='New Desc') + self.assert_(redirect.startswith('http://nohost/erp5/event_module/')) + new_id = redirect[ + len('http://nohost/erp5/event_module/'):].split('/', 1)[0] + new_event = self.portal.event_module._getOb(new_id) + self.assertEquals(ticket, new_event.getFollowUpValue()) + self.assertEquals('planned', new_event.getSimulationState()) + def test_Ticket_CreateRelatedEventUnauthorized(self): + # test that we don't get Unauthorized error when invoking the "Create + # New Event" without add permission on the module + ticket = self.portal.meeting_module.newContent(portal_type='Meeting') + self.portal.event_module.manage_permission('Add portal content', [], 0) + ticket.Ticket_newEvent(portal_type='Letter', + title='New Title', + description='New Desc', + direction='incoming') + class TestCRMMailIngestion(ERP5TypeTestCase): """Test Mail Ingestion for CRM. -- 2.30.9