Commit 789f6a14 authored by Jérome Perrin's avatar Jérome Perrin

this test should not hardcode portal ID


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19368 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 82cf9b8d
...@@ -46,16 +46,17 @@ class TestCRM(ERP5TypeTestCase): ...@@ -46,16 +46,17 @@ class TestCRM(ERP5TypeTestCase):
def test_Event_CreateRelatedEvent(self): def test_Event_CreateRelatedEvent(self):
# test action to create a related event from an event # test action to create a related event from an event
event_module = self.portal.event_module
event_module_url = event_module.absolute_url()
for ptype in self.portal.getPortalEventTypeList(): for ptype in self.portal.getPortalEventTypeList():
event = self.portal.event_module.newContent( event = event_module.newContent(portal_type=ptype)
portal_type=ptype)
redirect = event.Event_createRelatedEvent( redirect = event.Event_createRelatedEvent(
portal_type=ptype, portal_type=ptype,
title='New Title', title='New Title',
description='New Desc') description='New Desc')
self.assert_(redirect.startswith('http://nohost/erp5/event_module/')) self.assert_(redirect.startswith(event_module_url), redirect)
new_id = redirect[ # event_module_url does not contain trailing slash, so add +1 to its len
len('http://nohost/erp5/event_module/'):].split('/', 1)[0] new_id = redirect[len(event_module_url)+1:].split('/', 1)[0]
new_event = self.portal.event_module._getOb(new_id) new_event = self.portal.event_module._getOb(new_id)
self.assertEquals(event, new_event.getCausalityValue()) self.assertEquals(event, new_event.getCausalityValue())
...@@ -71,6 +72,7 @@ class TestCRM(ERP5TypeTestCase): ...@@ -71,6 +72,7 @@ class TestCRM(ERP5TypeTestCase):
def test_Ticket_CreateRelatedEvent(self): def test_Ticket_CreateRelatedEvent(self):
# test action to create a related event from a ticket # test action to create a related event from a ticket
event_module_url = self.portal.event_module.absolute_url()
ticket = self.portal.meeting_module.newContent(portal_type='Meeting') ticket = self.portal.meeting_module.newContent(portal_type='Meeting')
for ptype in self.portal.getPortalEventTypeList(): for ptype in self.portal.getPortalEventTypeList():
# incoming # incoming
...@@ -78,9 +80,8 @@ class TestCRM(ERP5TypeTestCase): ...@@ -78,9 +80,8 @@ class TestCRM(ERP5TypeTestCase):
portal_type=ptype, portal_type=ptype,
title='New Title', title='New Title',
description='New Desc') description='New Desc')
self.assert_(redirect.startswith('http://nohost/erp5/event_module/')) self.assert_(redirect.startswith(event_module_url), redirect)
new_id = redirect[ new_id = redirect[len(event_module_url)+1:].split('/', 1)[0]
len('http://nohost/erp5/event_module/'):].split('/', 1)[0]
new_event = self.portal.event_module._getOb(new_id) new_event = self.portal.event_module._getOb(new_id)
self.assertEquals(ticket, new_event.getFollowUpValue()) self.assertEquals(ticket, new_event.getFollowUpValue())
self.assertEquals('new', new_event.getSimulationState()) self.assertEquals('new', new_event.getSimulationState())
...@@ -90,9 +91,8 @@ class TestCRM(ERP5TypeTestCase): ...@@ -90,9 +91,8 @@ class TestCRM(ERP5TypeTestCase):
portal_type=ptype, portal_type=ptype,
title='New Title', title='New Title',
description='New Desc') description='New Desc')
self.assert_(redirect.startswith('http://nohost/erp5/event_module/')) self.assert_(redirect.startswith(event_module_url), redirect)
new_id = redirect[ new_id = redirect[len(event_module_url)+1:].split('/', 1)[0]
len('http://nohost/erp5/event_module/'):].split('/', 1)[0]
new_event = self.portal.event_module._getOb(new_id) new_event = self.portal.event_module._getOb(new_id)
self.assertEquals(ticket, new_event.getFollowUpValue()) self.assertEquals(ticket, new_event.getFollowUpValue())
self.assertEquals('planned', new_event.getSimulationState()) self.assertEquals('planned', new_event.getSimulationState())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment