Commit b3b0b703 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Rewrite test_cloneEvent to be more useful for the current spec.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39308 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 382d26bd
...@@ -1395,20 +1395,33 @@ class TestCRMMailSend(BaseTestCRM): ...@@ -1395,20 +1395,33 @@ class TestCRMMailSend(BaseTestCRM):
All events uses after script and interaciton All events uses after script and interaciton
workflow add a test for clone workflow add a test for clone
""" """
portal_type = "Mail Message" # XXX in the case of title, getTitle ignores the title attribute,
title = "Title of the event" # if any data is stored. In the case of text_content, getTextContent
content = "This is the content of the event" # respects the text_content attribute, even if any data is stored.
# This sounds inconsistent, but this seems to be the spec.
portal_type = 'Mail Message'
dummy_title = 'Dummy title'
real_title = 'Real Title'
dummy_content = 'Dummy content'
real_content = 'Real content'
event = self.portal.event_module.newContent(portal_type=portal_type, event = self.portal.event_module.newContent(portal_type=portal_type,
title=title, title=dummy_title,
text_content=content,) text_content=real_content,)
event.setData("This is the context of the event...") self.assertFalse(event.hasFile(), '%r has a file' % (event,))
self.assertEquals(event.getTitle(), dummy_title)
self.assertEquals(event.getTextContent(), real_content)
event.setData('Subject: %s\r\n\r\n%s' % (real_title, dummy_content))
self.assertTrue(event.hasFile(), '%r has no file' % (event,))
self.assertEquals(event.getTitle(), real_title)
self.assertEquals(event.getTextContent(), real_content)
self.stepTic() self.stepTic()
new_event = event.Base_createCloneDocument(batch_mode=1) new_event = event.Base_createCloneDocument(batch_mode=1)
self.failIf(new_event.hasFile()) self.assertFalse(new_event.hasFile(), '%r has a file' % (new_event,))
self.assertEquals(new_event.getData(), "") self.assertEquals(new_event.getData(), '')
self.assertEquals(new_event.getTitle(), title) self.assertEquals(new_event.getTitle(), real_title)
self.assertEquals(new_event.getTextContent(), content) self.assertEquals(new_event.getTextContent(), real_content)
def test_suite(): def test_suite():
......
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