Commit cc090c0c authored by Ivan Tyagov's avatar Ivan Tyagov

Clean up test.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33488 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 37736e34
...@@ -292,7 +292,6 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -292,7 +292,6 @@ class TestIngestion(ERP5TypeTestCase):
context = getattr(document_module, document_id) context = getattr(document_module, document_id)
for revision, format in enumerate(format_list): for revision, format in enumerate(format_list):
filename = 'TEST-en-002.' + format filename = 'TEST-en-002.' + format
printAndLog('Ingesting file: ' + filename)
f = makeFileUpload(filename) f = makeFileUpload(filename)
context.edit(file=f) context.edit(file=f)
self.stepTic() self.stepTic()
...@@ -344,7 +343,6 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -344,7 +343,6 @@ class TestIngestion(ERP5TypeTestCase):
old_portal_type = '' old_portal_type = ''
for extension, portal_type in extension_to_type: for extension, portal_type in extension_to_type:
filename = 'TEST-en-002.' + extension filename = 'TEST-en-002.' + extension
printAndLog(filename)
file = makeFileUpload(filename) file = makeFileUpload(filename)
# if we change portal type we must change version because # if we change portal type we must change version because
# mergeRevision would fail # mergeRevision would fail
...@@ -352,13 +350,10 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -352,13 +350,10 @@ class TestIngestion(ERP5TypeTestCase):
counter += 1 counter += 1
old_portal_type = portal_type old_portal_type = portal_type
file.filename = 'TEST-en-00%d.%s' % (counter, extension) file.filename = 'TEST-en-00%d.%s' % (counter, extension)
printAndLog(file.filename)
if with_portal_type: if with_portal_type:
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()
created_documents.append(ob) created_documents.append(ob)
self.stepTic() self.stepTic()
# inspect created objects # inspect created objects
...@@ -410,11 +405,8 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -410,11 +405,8 @@ class TestIngestion(ERP5TypeTestCase):
contributor='person_module/james') contributor='person_module/james')
# pass to discovery file_name and user_login # pass to discovery file_name and user_login
context.discoverMetadata(context.getSourceReference(), 'john_doe') context.discoverMetadata(context.getSourceReference(), 'john_doe')
context.reindexObject()
self.stepTic() self.stepTic()
#transaction.commit()
#self.tic()
def checkMetadataOrder(self, expected_metadata, document_id='one'): def checkMetadataOrder(self, expected_metadata, document_id='one'):
""" """
Asserts that metadata of document ID document_id Asserts that metadata of document ID document_id
...@@ -547,7 +539,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -547,7 +539,7 @@ class TestIngestion(ERP5TypeTestCase):
self.assertEquals(document.getRevision(), '2') self.assertEquals(document.getRevision(), '2')
document.reindexObject() document.reindexObject()
transaction.commit() transaction.commit()
def stepUploadFromViewForm(self, sequence=None, sequence_list=None, **kw): def stepUploadFromViewForm(self, sequence=None, sequence_list=None, **kw):
""" """
Upload a file from view form and make sure this increases the revision Upload a file from view form and make sure this increases the revision
...@@ -559,7 +551,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -559,7 +551,7 @@ class TestIngestion(ERP5TypeTestCase):
self.assertEquals(context.getRevision(), str(int(revision) + 1)) self.assertEquals(context.getRevision(), str(int(revision) + 1))
context.reindexObject() context.reindexObject()
transaction.commit() transaction.commit()
def stepUploadTextFromContributionTool(self, sequence=None, sequence_list=None, **kw): def stepUploadTextFromContributionTool(self, sequence=None, sequence_list=None, **kw):
""" """
Upload a file from contribution. Upload a file from contribution.
...@@ -582,9 +574,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -582,9 +574,7 @@ class TestIngestion(ERP5TypeTestCase):
f.filename = 'TEST-en-002.doc' f.filename = 'TEST-en-002.doc'
self.portal.portal_contributions.newContent(file=f) self.portal.portal_contributions.newContent(file=f)
transaction.commit() self.stepTic()
self.tic()
transaction.commit()
self.assertEquals(context.getRevision(), str(int(revision) + 1)) self.assertEquals(context.getRevision(), str(int(revision) + 1))
self.assert_('This document is modified.' in context.asText()) self.assert_('This document is modified.' in context.asText())
self.assertEquals(len(self.portal.document_module.objectIds()), self.assertEquals(len(self.portal.document_module.objectIds()),
...@@ -599,11 +589,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -599,11 +589,7 @@ class TestIngestion(ERP5TypeTestCase):
""" """
f = makeFileUpload('ANOTHE-en-001.doc') f = makeFileUpload('ANOTHE-en-001.doc')
self.portal.portal_contributions.newContent(id='two', file=f) self.portal.portal_contributions.newContent(id='two', file=f)
self.stepTic()
transaction.commit()
self.tic()
transaction.commit()
context = self.getDocument('two') context = self.getDocument('two')
self.assert_('This is a another very interesting document.' in context.asText()) self.assert_('This is a another very interesting document.' in context.asText())
self.assertEquals(context.getReference(), 'ANOTHE') self.assertEquals(context.getReference(), 'ANOTHE')
...@@ -667,8 +653,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -667,8 +653,7 @@ class TestIngestion(ERP5TypeTestCase):
context = self.getDocument('one') context = self.getDocument('one')
f = makeFileUpload('TEST-en-002.doc') f = makeFileUpload('TEST-en-002.doc')
context.edit(file=f) context.edit(file=f)
transaction.commit() self.stepTic()
self.tic()
# Then make sure content discover works # Then make sure content discover works
property_dict = context.getPropertyDictFromUserLogin() property_dict = context.getPropertyDictFromUserLogin()
self.assertEquals(property_dict['contributor'], 'person_module/john') self.assertEquals(property_dict['contributor'], 'person_module/john')
...@@ -690,8 +675,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -690,8 +675,7 @@ class TestIngestion(ERP5TypeTestCase):
subject='another subject', subject='another subject',
description='another description') description='another description')
context.edit(**kw) context.edit(**kw)
context.reindexObject(); transaction.commit(); self.stepTic()
self.tic();
def stepCheckChangedMetadata(self, sequence=None, sequence_list=None, **kw): def stepCheckChangedMetadata(self, sequence=None, sequence_list=None, **kw):
""" """
...@@ -911,8 +895,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -911,8 +895,7 @@ class TestIngestion(ERP5TypeTestCase):
""" """
f = open(makeFilePath('email_from.txt')) f = open(makeFilePath('email_from.txt'))
document = self.receiveEmail(data=f.read()) document = self.receiveEmail(data=f.read())
transaction.commit() self.stepTic()
self.tic()
def stepReceiveEmailFromJohn(self, sequence=None, sequence_list=None, **kw): def stepReceiveEmailFromJohn(self, sequence=None, sequence_list=None, **kw):
""" """
...@@ -920,8 +903,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -920,8 +903,7 @@ class TestIngestion(ERP5TypeTestCase):
""" """
f = open(makeFilePath('email_from.txt')) f = open(makeFilePath('email_from.txt'))
document = self.receiveEmail(f.read()) document = self.receiveEmail(f.read())
transaction.commit() self.stepTic()
self.tic()
def stepVerifyEmailedDocuments(self, sequence=None, sequence_list=None, **kw): def stepVerifyEmailedDocuments(self, sequence=None, sequence_list=None, **kw):
""" """
...@@ -946,7 +928,6 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -946,7 +928,6 @@ class TestIngestion(ERP5TypeTestCase):
document = result[0].getObject() document = result[0].getObject()
self.assertEqual(document.getRelativeUrl(), result[0].getRelativeUrl()) self.assertEqual(document.getRelativeUrl(), result[0].getRelativeUrl())
def playSequence(self, step_list, quiet): def playSequence(self, step_list, quiet):
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = ' '.join(step_list) sequence_string = ' '.join(step_list)
...@@ -1397,13 +1378,10 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1397,13 +1378,10 @@ class TestIngestion(ERP5TypeTestCase):
# Clear catalog # Clear catalog
portal_catalog = self.getCatalogTool() portal_catalog = self.getCatalogTool()
portal_catalog.manage_catalogClear() portal_catalog.manage_catalogClear()
# Commit
transaction.commit()
# Reindex all # Reindex all
portal.ERP5Site_reindexAll() portal.ERP5Site_reindexAll()
transaction.commit() self.stepTic()
self.tic()
transaction.commit()
self.assertEquals(1, self.assertEquals(1,
len(portal.portal_catalog(path=contribution_tool.getPath()))) len(portal.portal_catalog(path=contribution_tool.getPath())))
...@@ -1420,8 +1398,7 @@ class TestIngestion(ERP5TypeTestCase): ...@@ -1420,8 +1398,7 @@ class TestIngestion(ERP5TypeTestCase):
my_filename = 'Something.doc' my_filename = 'Something.doc'
document = contribution_tool.newContent(file=file_object, document = contribution_tool.newContent(file=file_object,
file_name=my_filename) file_name=my_filename)
transaction.commit() self.stepTic()
self.tic()
self.assertEquals(document.getSourceReference(), my_filename) self.assertEquals(document.getSourceReference(), my_filename)
# Missing tests # Missing tests
......
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