[Erp5-report] r41655 nicolas - /erp5/trunk/products/ERP5OOo/tests/testIngestion.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Dec 22 12:44:58 CET 2010


Author: nicolas
Date: Wed Dec 22 12:44:58 2010
New Revision: 41655

URL: http://svn.erp5.org?rev=41655&view=rev
Log:
Check that id parameter is honoured

Modified:
    erp5/trunk/products/ERP5OOo/tests/testIngestion.py

Modified: erp5/trunk/products/ERP5OOo/tests/testIngestion.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testIngestion.py?rev=41655&r1=41654&r2=41655&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testIngestion.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testIngestion.py [utf8] Wed Dec 22 12:44:58 2010
@@ -45,6 +45,7 @@ from Products.ERP5OOo.Document.OOoDocume
 from Products.ERP5OOo.OOoUtils import OOoBuilder
 from zLOG import LOG, INFO, ERROR
 from Products.CMFCore.utils import getToolByName
+from zExceptions import BadRequest
 
 # test files' home
 TEST_FILES_HOME = os.path.join(os.path.dirname(__file__), 'test_document')
@@ -1964,6 +1965,34 @@ return result
     self.assertEquals(len(result_list), 1)
     self.assertEquals(result_list[0].getPortalType(), 'PDF')
 
+  def test_User_ID_parameter_is_honoured(self):
+    """Check that given id is always honoured
+    """
+    path = makeFilePath('import_region_category.xls')
+    data = open(path, 'r').read()
+
+    document = self.portal.portal_contributions.newContent(
+                                      id='this_id',
+                                      filename='import_region_category.xls',
+                                      data=data,
+                                      content_type='application/vnd.ms-excel',
+                                      reference='I.want.a.pdf',
+                                      portal_type='PDF')
+    transaction.commit()
+    self.tic()
+    result_list = self.portal.portal_catalog(reference='I.want.a.pdf',
+                                             id='this_id')
+    self.assertEquals(len(result_list), 1)
+    self.assertRaises(BadRequest,
+                      self.portal.portal_contributions.newContent,
+                      id='this_id',
+                      filename='import_region_category.xls',
+                      data=data,
+                      content_type='application/vnd.ms-excel',
+                      reference='I.want.a.pdf',
+                      portal_type='PDF')
+
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestIngestion))



More information about the Erp5-report mailing list