Commit 07cd9772 authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: more test

parent d96a09d6
...@@ -517,6 +517,37 @@ class TestTicket_createProjectEvent(TestCRMSkinsMixin): ...@@ -517,6 +517,37 @@ class TestTicket_createProjectEvent(TestCRMSkinsMixin):
self.assertSameEventAttachmentList(event) self.assertSameEventAttachmentList(event)
self.assertEquals(event.getSimulationState(), 'stopped') self.assertEquals(event.getSimulationState(), 'stopped')
def test_Ticket_createProjectEvent_incomingEventWithSourceAndDestination(self):
ticket = self.createUsualTicket()
source_value = self.portal.person_module.newContent(
portal_type='Person',
title='custom source person'
)
destination_value = self.portal.person_module.newContent(
portal_type='Person',
title='custom destination person'
)
event = ticket.Ticket_createProjectEvent(
'foo_title', 'incoming', 'Letter',
'foo resource', 'foo text',
source=source_value.getRelativeUrl(),
destination=destination_value.getRelativeUrl()
)
self.assertEquals(event.getPortalType(), 'Letter')
self.assertEquals(event.getTitle(), 'foo_title')
self.assertEquals(event.getFollowUp(), ticket.getRelativeUrl())
self.assertEquals(event.getResource(), 'foo resource')
self.assertEquals(event.getSource(), source_value.getRelativeUrl())
self.assertEquals(event.getSourceSection(), ticket.getDestinationSection())
self.assertEquals(event.getSourceProject(), ticket.getDestinationProject())
self.assertEquals(event.getDestination(), destination_value.getRelativeUrl())
self.assertEquals(event.getDestinationSection(), ticket.getSourceSection())
self.assertEquals(event.getDestinationProject(), ticket.getSourceProject())
self.assertEquals(event.getTextContent(), 'foo text')
self.assertEquals(event.getContentType(), 'text/plain')
self.assertSameEventAttachmentList(event)
self.assertEquals(event.getSimulationState(), 'stopped')
def test_Ticket_createProjectEvent_incomingEventWithAttachment(self): def test_Ticket_createProjectEvent_incomingEventWithAttachment(self):
ticket = self.createUsualTicket() ticket = self.createUsualTicket()
event = ticket.Ticket_createProjectEvent( event = ticket.Ticket_createProjectEvent(
...@@ -564,3 +595,34 @@ class TestTicket_createProjectEvent(TestCRMSkinsMixin): ...@@ -564,3 +595,34 @@ class TestTicket_createProjectEvent(TestCRMSkinsMixin):
self.assertSameEventAttachmentList(event) self.assertSameEventAttachmentList(event)
self.assertEquals(event.getSimulationState(), 'delivered') self.assertEquals(event.getSimulationState(), 'delivered')
def test_Ticket_createProjectEvent_outgoingEventWithSourceAndDestination(self):
ticket = self.createUsualTicket()
source_value = self.portal.person_module.newContent(
portal_type='Person',
title='custom source person'
)
destination_value = self.portal.person_module.newContent(
portal_type='Person',
title='custom destination person'
)
event = ticket.Ticket_createProjectEvent(
'foo_title', 'outgoing', 'Web Message',
'foo resource', 'foo text',
source=source_value.getRelativeUrl(),
destination=destination_value.getRelativeUrl()
)
self.assertEquals(event.getPortalType(), 'Web Message')
self.assertEquals(event.getTitle(), 'foo_title')
self.assertEquals(event.getFollowUp(), ticket.getRelativeUrl())
self.assertEquals(event.getResource(), 'foo resource')
self.assertEquals(event.getDestination(), destination_value.getRelativeUrl())
self.assertEquals(event.getDestinationSection(), ticket.getDestinationSection())
self.assertEquals(event.getDestinationProject(), ticket.getDestinationProject())
self.assertEquals(event.getSource(), source_value.getRelativeUrl())
self.assertEquals(event.getSourceSection(), ticket.getSourceSection())
self.assertEquals(event.getSourceProject(), ticket.getSourceProject())
self.assertEquals(event.getTextContent(), 'foo text')
self.assertEquals(event.getContentType(), 'text/plain')
self.assertSameEventAttachmentList(event)
self.assertEquals(event.getSimulationState(), 'delivered')
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