Commit e56d66c6 authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_crm: fix tests on ticket event and getRSSTextContent

parent bec6418b
......@@ -157,21 +157,98 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
ticket = newUpgradeDecision()
self._test_upgrade_decision(ticket, 2)
class TestSlapOSEvent_getRSSTextContent(testSlapOSMixin):
class TestSlapOSTicketEvent(testSlapOSMixin):
def beforeTearDown(self):
transaction.abort()
def test_Event_getRSSTextContent(self):
def afterSetUp(self):
super(TestSlapOSTicketEvent, self).afterSetUp()
def _test_event(self, ticket):
def newEvent(ticket):
event = self.portal.event_module.newContent(
title="Test Event %s" % self.new_id,
portal_type="Web Message",
follow_up_value=ticket)
event.immediateReindexObject()
return event
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, None)
event = newEvent(ticket)
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, None)
event.plan()
event.immediateReindexObject()
self.assertEquals(last_event, None)
event.confirm()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
event.start()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
event.stop()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
event.deliver()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
# Now we test unwanted cases (deleted and cancelled)
another_event = newEvent(ticket)
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
another_event.cancel()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
another_event = newEvent(ticket)
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
another_event.delete()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
class TestSlapOSEvent_getRSSTextContent(TestSlapOSTicketEvent):
def afterSetUp(self):
super(TestSlapOSEvent_getRSSTextContent, self).afterSetUp()
self.new_id = self.generateNewId()
source = self.portal.person_module.newContent(
self.person = self.portal.person_module.newContent(
portal_type='Person',
title="Person %s" % self.new_id,
reference="TESTPERS-%s" % self.new_id,
default_email_text="live_test_%s@example.org" % self.new_id,
)
def beforeTearDown(self):
transaction.abort()
def test_Event_getRSSTextContent(self):
source = self.person
destination = self.portal.person_module.newContent(
portal_type='Person',
title="Person Destination %s" % self.new_id,
......@@ -234,7 +311,7 @@ class TestSlapOSEvent_getRSSTextContent(testSlapOSMixin):
self._test_event(ticket)
class TestSlapOSTicket_getLatestEvent(testSlapOSMixin):
class TestSlapOSTicket_getLatestEvent(TestSlapOSTicketEvent):
def beforeTearDown(self):
transaction.abort()
......@@ -249,72 +326,6 @@ class TestSlapOSTicket_getLatestEvent(testSlapOSMixin):
default_email_text="live_test_%s@example.org" % self.new_id,
)
def _test_event(self, ticket):
def newEvent(ticket):
event = self.portal.event_module.newContent(
title="Test Event %s" % self.new_id,
portal_type="Web Message",
follow_up_value=ticket)
event.immediateReindexObject()
return event
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, None)
event = newEvent(ticket)
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, None)
event.plan()
event.immediateReindexObject()
self.assertEquals(last_event, None)
event.confirm()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
event.start()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
event.stop()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
event.deliver()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
# Now we test unwanted cases (deleted and cancelled)
another_event = newEvent(ticket)
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
another_event.cancel()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
another_event = newEvent(ticket)
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
another_event.delete()
event.immediateReindexObject()
last_event = ticket.Ticket_getLatestEvent()
self.assertEquals(last_event, event)
def test_support_request(self):
ticket = self.portal.support_request_module.newContent(\
title="Test Support Request %s" % self.new_id,
......
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