From de3c9b3180e22c2fd0525a82ddab9e012f2a0ed7 Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Sat, 4 Dec 2010 15:17:55 +0000 Subject: [PATCH] Fix test which was reading redicte URL to read the id of new created Event. Unfortunately it was not able to strip URL parameters... Now it used more standart API, thanks to follow_up relationship. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41127 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testCRM.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/product/ERP5/tests/testCRM.py b/product/ERP5/tests/testCRM.py index 29a74531e1..8bfdfb4894 100644 --- a/product/ERP5/tests/testCRM.py +++ b/product/ERP5/tests/testCRM.py @@ -142,25 +142,24 @@ class TestCRM(BaseTestCRM): for ptype in [x for x in self.portal.getPortalEventTypeList() if x != 'Acknowledgement']: # incoming - redirect = ticket.Ticket_newEvent(direction='incoming', - portal_type=ptype, - title='New Title', - description='New Desc') - self.assert_(redirect.startswith(event_module_url), redirect) - new_id = redirect[len(event_module_url)+1:].split('/', 1)[0] - new_event = self.portal.event_module._getOb(new_id) - self.assertEquals(ticket, new_event.getFollowUpValue()) + ticket.Ticket_newEvent(direction='incoming', + portal_type=ptype, + title='Incoming Title', + description='New Desc') + transaction.commit() + self.tic() + new_event = ticket.getFollowUpRelatedValueList()[0] self.assertEquals('new', new_event.getSimulationState()) # outgoing - redirect = ticket.Ticket_newEvent(direction='outgoing', + ticket.Ticket_newEvent(direction='outgoing', portal_type=ptype, - title='New Title', + title='Outgoing Title', description='New Desc') - self.assert_(redirect.startswith(event_module_url), redirect) - new_id = redirect[len(event_module_url)+1:].split('/', 1)[0] - new_event = self.portal.event_module._getOb(new_id) - self.assertEquals(ticket, new_event.getFollowUpValue()) + transaction.commit() + self.tic() + new_event = [event for event in ticket.getFollowUpRelatedValueList() if\ + event.getTitle() == 'Outgoing Title'][0] self.assertEquals('planned', new_event.getSimulationState()) def test_Ticket_CreateRelatedEventUnauthorized(self): -- 2.30.9