Commit e273a34c authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* support file uploading with another name in the test.

* remove duplicate test files.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26377 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3d63f4a4
...@@ -85,8 +85,11 @@ def printAndLog(msg): ...@@ -85,8 +85,11 @@ def printAndLog(msg):
def makeFilePath(name): def makeFilePath(name):
return os.getenv('INSTANCE_HOME') + '/../Products/ERP5OOo/tests/test_document/' + name return os.getenv('INSTANCE_HOME') + '/../Products/ERP5OOo/tests/test_document/' + name
def makeFileUpload(name): def makeFileUpload(name, as_name=None):
return FileUpload(makeFilePath(name), name) if as_name is None:
as_name = name
path = makeFilePath(name)
return FileUpload(path, as_name)
class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
...@@ -447,13 +450,13 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -447,13 +450,13 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
document1 = self.portal.portal_contributions.newContent(file=file) document1 = self.portal.portal_contributions.newContent(file=file)
# (2) TEST, 002, fr # (2) TEST, 002, fr
filename = 'TEST-fr-002.odt' as_name = 'TEST-fr-002.odt'
file = makeFileUpload(filename) file = makeFileUpload(filename, as_name)
document2 = self.portal.portal_contributions.newContent(file=file) document2 = self.portal.portal_contributions.newContent(file=file)
# (3) TEST, 003, en # (3) TEST, 003, en
filename = 'TEST-en-003.odt' as_name = 'TEST-en-003.odt'
file = makeFileUpload(filename) file = makeFileUpload(filename, as_name)
document3 = self.portal.portal_contributions.newContent(file=file) document3 = self.portal.portal_contributions.newContent(file=file)
# create docs to contain references in text_content: # create docs to contain references in text_content:
......
...@@ -64,9 +64,11 @@ def printAndLog(msg): ...@@ -64,9 +64,11 @@ def printAndLog(msg):
def makeFilePath(name): def makeFilePath(name):
return os.path.join(TEST_FILES_HOME, name) return os.path.join(TEST_FILES_HOME, name)
def makeFileUpload(name): def makeFileUpload(name, as_name=None):
if as_name is None:
as_name = name
path = makeFilePath(name) path = makeFilePath(name)
return FileUpload(path, name) return FileUpload(path, as_name)
class TestIngestion(ERP5TypeTestCase): class TestIngestion(ERP5TypeTestCase):
""" """
...@@ -1352,7 +1354,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1352,7 +1354,7 @@ class TestIngestion(ERP5TypeTestCase):
""" """
Upload a file from contribution. Upload a file from contribution.
""" """
f = makeFileUpload('T&é@{T-en-002.doc') f = makeFileUpload('TEST-en-002.doc', 'T&é@{T-en-002.doc')
document = self.portal.portal_contributions.newContent(file=f) document = self.portal.portal_contributions.newContent(file=f)
sequence.edit(document_id=document.getId()) sequence.edit(document_id=document.getId())
get_transaction().commit() get_transaction().commit()
......
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