[Erp5-report] r19497 - /erp5/trunk/products/ERP5/tests/testAccounting.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Feb 25 17:08:01 CET 2008


Author: yusei
Date: Mon Feb 25 17:08:01 2008
New Revision: 19497

URL: http://svn.erp5.org?rev=19497&view=rev
Log:
Add TestAccountingTransactionTemplate.

Modified:
    erp5/trunk/products/ERP5/tests/testAccounting.py

Modified: erp5/trunk/products/ERP5/tests/testAccounting.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccounting.py?rev=19497&r1=19496&r2=19497&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py Mon Feb 25 17:08:01 2008
@@ -40,6 +40,7 @@
 from Products.DCWorkflow.DCWorkflow import ValidationFailed
 from AccessControl.SecurityManagement import newSecurityManager
 from Products.ERP5Type.tests.Sequence import Sequence, SequenceList
+from Products.ERP5Form.Document.Preference import Priority
 
 SOURCE = 'source'
 DESTINATION = 'destination'
@@ -3025,6 +3026,50 @@
     self.assertTrue('Some comments' in searchable_text)
 
 
+class TestAccountingTransactionTemplate(AccountingTestCase):
+  """A test for Accounting Transaction Template
+  """
+
+  def getTitle(self):
+    return "Accounting Transaction Template"
+
+  def test_Template(self):
+    self.login('claudie')
+    preference = self.portal.portal_preferences.newContent('Preference')
+    preference.priority = Priority.USER
+    preference.enable()
+
+    get_transaction().commit()
+    self.tic()
+
+    document = self.accounting_module.newContent(portal_type='Accounting Transaction')
+    document.edit(title='My Accounting Transaction')
+    document.Base_makeTemplateFromDocument(form_id=None)
+
+    get_transaction().commit()
+    self.tic()
+
+    self.assertEqual(len(preference.objectIds()), 1)
+
+    self.accounting_module.manage_delObjects(ids=[document.getId()])
+
+    get_transaction().commit()
+    self.tic()
+
+    template = preference.objectValues()[0]
+
+    cp = preference.manage_copyObjects(ids=[template.getId()], REQUEST=None, RESPONSE=None)
+    new_document_list = self.accounting_module.manage_pasteObjects(cp)
+    new_document_id = new_document_list[0]['new_id']
+    new_document = self.accounting_module[new_document_id]
+    new_document.makeTemplateInstance()
+
+    get_transaction().commit()
+    self.tic()
+
+    self.assertEqual(new_document.getTitle(), 'My Accounting Transaction')
+
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestAccounting))




More information about the Erp5-report mailing list