[Erp5-report] r19349 - /erp5/trunk/products/ERP5/tests/testCRM.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Feb 18 14:06:39 CET 2008
Author: jerome
Date: Mon Feb 18 14:06:39 2008
New Revision: 19349
URL: http://svn.erp5.org?rev=19349&view=rev
Log:
new test class for general CRM feature. We'll test related event creation
action
Modified:
erp5/trunk/products/ERP5/tests/testCRM.py
Modified: erp5/trunk/products/ERP5/tests/testCRM.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testCRM.py?rev=19349&r1=19348&r2=19349&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testCRM.py (original)
+++ erp5/trunk/products/ERP5/tests/testCRM.py Mon Feb 18 14:06:39 2008
@@ -34,6 +34,42 @@
from Products.ERP5OOo.tests.testIngestion import FILE_NAME_REGULAR_EXPRESSION
from Products.ERP5OOo.tests.testIngestion import REFERENCE_REGULAR_EXPRESSION
+TEST_HOME = os.path.dirname(__file__)
+
+def openTestFile(filename):
+ return file(os.path.join(TEST_HOME, 'test_data', 'crm_emails', filename))
+
+
+class TestCRM(ERP5TypeTestCase):
+ def getBusinessTemplateList(self):
+ return ('erp5_base', 'erp5_crm',)
+
+ def test_CreateRelatedEvent(self):
+ # test action to create a related event
+ for ptype in self.portal.getPortalEventTypeList():
+ event = self.portal.event_module.newContent(
+ portal_type=ptype)
+ redirect = event.Event_createRelatedEvent(
+ portal_type=ptype,
+ title='New Title',
+ description='New Desc')
+ self.assert_(redirect.startswith('http://nohost/erp5/event_module/'))
+ new_id = redirect[
+ len('http://nohost/erp5/event_module/'):].split('/', 1)[0]
+ new_event = self.portal.event_module._getOb(new_id)
+ self.assertEquals(event, new_event.getCausalityValue())
+
+ def test_CreateRelatedEventUnauthorized(self):
+ # test that we don't get Unauthorized error when invoking the "Create
+ # Related Event" without add permission on the module
+ event = self.portal.event_module.newContent(portal_type='Letter')
+ self.portal.event_module.manage_permission('Add portal content', [], 0)
+ redirect = event.Event_createRelatedEvent(
+ portal_type='Letter',
+ title='New Title',
+ description='New Desc')
+
+
class TestCRMMailIngestion(ERP5TypeTestCase):
"""Test Mail Ingestion for CRM.
@@ -168,11 +204,6 @@
## event = self._ingestMail('utf8')
##
-TEST_HOME = os.path.dirname(__file__)
-
-def openTestFile(filename):
- return file(os.path.join(TEST_HOME, 'test_data', 'crm_emails', filename))
-
class TestCRMMailSend(ERP5TypeTestCase):
"""Test Mail Sending for CRM
"""
@@ -664,8 +695,10 @@
part = i
self.assertEqual(part.get_payload(decode=True), str(document_gif.getData()))
+
def test_suite():
suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestCRM))
suite.addTest(unittest.makeSuite(TestCRMMailIngestion))
suite.addTest(unittest.makeSuite(TestCRMMailSend))
return suite
More information about the Erp5-report
mailing list