Commit 1991546f authored by Nicolas Delaby's avatar Nicolas Delaby

Check that id parameter is honoured


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41655 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 601e1f99
...@@ -45,6 +45,7 @@ from Products.ERP5OOo.Document.OOoDocument import ConversionError ...@@ -45,6 +45,7 @@ from Products.ERP5OOo.Document.OOoDocument import ConversionError
from Products.ERP5OOo.OOoUtils import OOoBuilder from Products.ERP5OOo.OOoUtils import OOoBuilder
from zLOG import LOG, INFO, ERROR from zLOG import LOG, INFO, ERROR
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from zExceptions import BadRequest
# test files' home # test files' home
TEST_FILES_HOME = os.path.join(os.path.dirname(__file__), 'test_document') TEST_FILES_HOME = os.path.join(os.path.dirname(__file__), 'test_document')
...@@ -1964,6 +1965,34 @@ return result ...@@ -1964,6 +1965,34 @@ return result
self.assertEquals(len(result_list), 1) self.assertEquals(len(result_list), 1)
self.assertEquals(result_list[0].getPortalType(), 'PDF') 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(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestIngestion)) suite.addTest(unittest.makeSuite(TestIngestion))
......
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