Commit c129e689 authored by Ivan Tyagov's avatar Ivan Tyagov

Add clean up step between tests to avoid confusion by left content from previous tests.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14114 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent aa53041b
...@@ -57,6 +57,8 @@ os.environ['EVENT_LOG_SEVERITY'] = '-300' ...@@ -57,6 +57,8 @@ os.environ['EVENT_LOG_SEVERITY'] = '-300'
# Define the conversion server host # Define the conversion server host
conversion_server_host = ('127.0.0.1', 8008) conversion_server_host = ('127.0.0.1', 8008)
# test files' home
TEST_FILES_HOME = os.path.join(os.getenv('INSTANCE_HOME'), 'Products', 'ERP5OOo', 'tests', 'test_document')
def printAndLog(msg): def printAndLog(msg):
""" """
...@@ -78,7 +80,7 @@ class FileUploadTest(file): ...@@ -78,7 +80,7 @@ class FileUploadTest(file):
self.headers = {} self.headers = {}
def makeFilePath(name): def makeFilePath(name):
return os.getenv('INSTANCE_HOME') + '/../Products/ERP5OOo/tests/test_document/' + name return os.path.join(TEST_FILES_HOME, name)
def makeFileUpload(name): def makeFileUpload(name):
path = makeFilePath(name) path = makeFilePath(name)
...@@ -374,6 +376,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -374,6 +376,7 @@ class TestIngestion(ERP5TypeTestCase):
ob = self.portal.portal_contributions.newContent(portal_type=portal_type, file=file) ob = self.portal.portal_contributions.newContent(portal_type=portal_type, file=file)
else: else:
ob = self.portal.portal_contributions.newContent(file=file) ob = self.portal.portal_contributions.newContent(file=file)
# reindex
ob.immediateReindexObject() ob.immediateReindexObject()
created_documents.append(ob) created_documents.append(ob)
get_transaction().commit() get_transaction().commit()
...@@ -784,6 +787,14 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -784,6 +787,14 @@ class TestIngestion(ERP5TypeTestCase):
context = self.getDocument('one') context = self.getDocument('one')
context.deleteSnapshot() context.deleteSnapshot()
def stepCleanUp(self, sequence=None, sequence_list=None, **kw):
"""
Clean up DMS system from old content.
"""
portal = self.getPortal()
for module in (portal.document_module, portal.image_module,):
module.manage_delObjects(map(None, module.objectIds()))
def stepContributeFileListWithType(self, sequence=None, sequence_list=None, **kw): def stepContributeFileListWithType(self, sequence=None, sequence_list=None, **kw):
""" """
Contribute all kinds of files giving portal type explicitly Contribute all kinds of files giving portal type explicitly
...@@ -959,7 +970,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -959,7 +970,8 @@ class TestIngestion(ERP5TypeTestCase):
if not run: return if not run: return
if not quiet: printAndLog('test_03_TextDoc') if not quiet: printAndLog('test_03_TextDoc')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepCreateTextDocument' step_list = ['stepCleanUp'
,'stepCreateTextDocument'
,'stepCheckEmptyState' ,'stepCheckEmptyState'
,'stepStraightUpload' ,'stepStraightUpload'
,'stepCheckConvertedState' ,'stepCheckConvertedState'
...@@ -988,7 +1000,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -988,7 +1000,8 @@ class TestIngestion(ERP5TypeTestCase):
if not run: return if not run: return
if not quiet: printAndLog('test_04_MetadataExtraction') if not quiet: printAndLog('test_04_MetadataExtraction')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepCreateTextDocument' step_list = [ 'stepCleanUp'
,'stepCreateTextDocument'
,'stepSetSimulatedDiscoveryScript' ,'stepSetSimulatedDiscoveryScript'
,'stepTestMetadataSetting' ,'stepTestMetadataSetting'
] ]
...@@ -1005,7 +1018,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1005,7 +1018,8 @@ class TestIngestion(ERP5TypeTestCase):
if not run: return if not run: return
if not quiet: printAndLog('test_04_MetadataEditing') if not quiet: printAndLog('test_04_MetadataEditing')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepCreateTextDocument' step_list = [ 'stepCleanUp'
,'stepCreateTextDocument'
,'stepDialogUpload' ,'stepDialogUpload'
,'stepEditMetadata' ,'stepEditMetadata'
,'stepCheckChangedMetadata' ,'stepCheckChangedMetadata'
...@@ -1028,7 +1042,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1028,7 +1042,8 @@ class TestIngestion(ERP5TypeTestCase):
if not run: return if not run: return
if not quiet: printAndLog('test_05_FormatIngestion') if not quiet: printAndLog('test_05_FormatIngestion')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = ['stepCreateTextDocument' step_list = ['stepCleanUp'
,'stepCreateTextDocument'
,'stepIngestTextFormats' ,'stepIngestTextFormats'
,'stepCreateSpreadsheetDocument' ,'stepCreateSpreadsheetDocument'
,'stepIngestSpreadsheetFormats' ,'stepIngestSpreadsheetFormats'
...@@ -1055,7 +1070,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1055,7 +1070,8 @@ class TestIngestion(ERP5TypeTestCase):
if not run: return if not run: return
if not quiet: printAndLog('test_06_FormatGeneration') if not quiet: printAndLog('test_06_FormatGeneration')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepCreateTextDocument' step_list = [ 'stepCleanUp'
,'stepCreateTextDocument'
,'stepCheckTextDocumentExportList' ,'stepCheckTextDocumentExportList'
,'stepCreateSpreadsheetDocument' ,'stepCreateSpreadsheetDocument'
,'stepCheckSpreadsheetDocumentExportList' ,'stepCheckSpreadsheetDocumentExportList'
...@@ -1081,7 +1097,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1081,7 +1097,8 @@ class TestIngestion(ERP5TypeTestCase):
if not run: return if not run: return
if not quiet: printAndLog('test_07_SnapshotGeneration') if not quiet: printAndLog('test_07_SnapshotGeneration')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepCreateTextDocument' step_list = [ 'stepCleanUp'
,'stepCreateTextDocument'
,'stepDialogUpload' ,'stepDialogUpload'
,'stepCheckHasNoSnapshot' ,'stepCheckHasNoSnapshot'
,'stepCreateSnapshot' ,'stepCreateSnapshot'
...@@ -1100,7 +1117,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1100,7 +1117,7 @@ class TestIngestion(ERP5TypeTestCase):
I don't know how to verify how cache works I don't know how to verify how cache works
""" """
def test_09_Contribute(self, quiet=QUIET, run=0): def test_09_Contribute(self, quiet=QUIET, run=RUN_ALL_TEST):
""" """
Create content through portal_contributions Create content through portal_contributions
- use newContent to ingest various types - use newContent to ingest various types
...@@ -1113,7 +1130,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1113,7 +1130,8 @@ class TestIngestion(ERP5TypeTestCase):
if not run: return if not run: return
if not quiet: printAndLog('test_09_Contribute') if not quiet: printAndLog('test_09_Contribute')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = ['stepContributeFileListWithNoType' step_list = [ 'stepCleanUp'
,'stepContributeFileListWithNoType'
,'stepContributeFileListWithType' ,'stepContributeFileListWithType'
] ]
sequence_string = ' '.join(step_list) sequence_string = ' '.join(step_list)
...@@ -1132,7 +1150,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1132,7 +1150,8 @@ class TestIngestion(ERP5TypeTestCase):
if not run: return if not run: return
if not quiet: printAndLog('test_10_MetadataSettingPreferenceOrder') if not quiet: printAndLog('test_10_MetadataSettingPreferenceOrder')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepCreateTextDocument' step_list = [ 'stepCleanUp'
,'stepCreateTextDocument'
,'stepStraightUpload' ,'stepStraightUpload'
,'stepSetSimulatedDiscoveryScriptForOrdering' ,'stepSetSimulatedDiscoveryScriptForOrdering'
,'stepCheckMetadataSettingOrderFICU' ,'stepCheckMetadataSettingOrderFICU'
...@@ -1166,7 +1185,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1166,7 +1185,8 @@ class TestIngestion(ERP5TypeTestCase):
if not run: return if not run: return
if not quiet: printAndLog('test_11_EmailIngestion') if not quiet: printAndLog('test_11_EmailIngestion')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepReceiveEmailFromUnknown' step_list = [ 'stepCleanUp'
,'stepReceiveEmailFromUnknown'
,'stepCreatePerson' ,'stepCreatePerson'
,'stepReceiveEmailFromJohn' ,'stepReceiveEmailFromJohn'
,'stepVerifyEmailedDocuments' ,'stepVerifyEmailedDocuments'
......
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