Commit 7856a2f1 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Show a more clear message

This help on mark it things read and know what it is happening.
parent c0b28184
"""
Include information of the sender/recipient to clarify.
"""
return """
Sender: %s
Recipient: %s
Content:
%s
""" % (context.getSourceTitle(""),
",".join(context.getDestinationTitleList()),
context.getTextContent())
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_getRSSTextContent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -271,7 +271,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: cell.SupportRequest_getLatestEvent() and cell.SupportRequest_getLatestEvent().getTextContent() or cell.getDescription()</string> </value>
<value> <string>python: cell.Ticket_getLatestEvent() and cell.Ticket_getLatestEvent().Event_getRSSTextContent() or cell.getDescription()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -156,8 +156,84 @@ class TestSlapOSFolder_getOpenTicketList(testSlapOSMixin):
ticket = newUpgradeDecision()
self._test_upgrade_decision(ticket, 2)
class TestSlapOSEvent_getRSSTextContent(testSlapOSMixin):
def beforeTearDown(self):
transaction.abort()
def test_Event_getRSSTextContent(self):
self.new_id = self.generateNewId()
source = 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,
)
destination = self.portal.person_module.newContent(
portal_type='Person',
title="Person Destination %s" % self.new_id,
reference="TESTPERSD-%s" % self.new_id,
default_email_text="live_test_%s@example.org" % self.new_id,
)
destination_2 = self.portal.person_module.newContent(
portal_type='Person',
title="Person Destination 2 %s" % self.new_id,
reference="TESTPERSD2-%s" % self.new_id,
default_email_text="live_test_%s@example.org" % self.new_id,
)
event = self.portal.event_module.newContent(
title="Test Event %s" % self.new_id,
portal_type="Web Message",
text_content="Test Event %s" % self.new_id)
text_content = event.Event_getRSSTextContent()
self.assertTrue(event.getTextContent() in text_content)
self.assertTrue("Sender: " in text_content, "Sender: not in %s" % text_content)
self.assertTrue("Recipient: " in text_content, "Recipient: not in %s" % text_content)
self.assertTrue("Content:" in text_content, "Content: not in %s" % text_content)
event.setSourceValue(source)
text_content = event.Event_getRSSTextContent()
self.assertTrue("Sender: %s" % source.getTitle() in text_content,
"Sender: %s not in %s" % (source.getTitle(), text_content))
event.setDestinationValue(destination)
text_content = event.Event_getRSSTextContent()
self.assertTrue("Recipient: %s" % destination.getTitle() in text_content,
"Recipient: %s not in %s" % (destination.getTitle(), text_content))
event.setDestinationValue(destination_2)
text_content = event.Event_getRSSTextContent()
self.assertTrue("Recipient: %s" % destination_2.getTitle() in text_content,
"Recipient: %s not in %s" % (destination.getTitle(), text_content))
event.setDestinationValueList([destination, destination_2])
text_content = event.Event_getRSSTextContent()
self.assertTrue(
"Recipient: %s,%s" % (destination.getTitle(),
destination_2.getTitle()) in text_content,
"Recipient: %s,%s not in %s" % (destination.getTitle(),
destination_2.getTitle(),
text_content)
)
def test_support_request(self):
ticket = self.portal.support_request_module.newContent(\
title="Test Support Request %s" % self.new_id,
resource="service_module/slapos_crm_monitoring",
destination_decision_value=self.person)
ticket.immediateReindexObject()
self._test_event(ticket)
class TestSlapOSTicket_getLatestEvent(testSlapOSMixin):
def beforeTearDown(self):
......
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