[Erp5-report] r33577 ivan - /erp5/trunk/products/ERP5OOo/tests/testIngestion.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Mar 10 13:28:50 CET 2010
Author: ivan
Date: Wed Mar 10 13:28:49 2010
New Revision: 33577
URL: http://svn.erp5.org?rev=33577&view=rev
Log:
Extend test to check better ingested document and add multiple timesingestion testing step.
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=33577&r1=33576&r2=33577&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testIngestion.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testIngestion.py [utf8] Wed Mar 10 13:28:49 2010
@@ -895,36 +895,56 @@
f = open(makeFilePath('email_from.txt'))
document = self.receiveEmail(f.read())
self.stepTic()
-
- def stepVerifyEmailedDocuments(self, sequence=None, sequence_list=None, **kw):
- """
- find the newly mailed-in document by its reference
- check its properties
- """
- # First, check document ingestion message
- result = self.portal_catalog(portal_type='Document Ingestion Message',
- title='A Test Mail',
- source_title='John Doe'
- )
- self.assertEqual(len(result), 1)
- ingestion_message = result[0].getObject()
-
- # Second, check attachments
- attachment_list = ingestion_message.getAggregateValueList()
- self.assertEqual(len(attachment_list), 1)
-
- # Third, check document
- result = self.portal_catalog(portal_type='Text')
- self.assertEqual(len(result), 1)
- document = result[0].getObject()
- self.assertEqual(document.getRelativeUrl(), result[0].getRelativeUrl())
+
+ def stepVerifyEmailedDocumentsInitialContribution(self, sequence=None, sequence_list=None, **kw):
+ """
+ Find the newly mailed-in document and check its properties.
+ """
+ attachment_list, ingested_document = self.verifyEmailedDocuments()
+ self.assertEquals('1', ingested_document.getRevision())
+
+ def stepVerifyEmailedDocumentsMultipleContribution(self, sequence=None, sequence_list=None, **kw):
+ """
+ Find the newly mailed-in document and check its properties.
+ """
+ attachment_list, ingested_document = self.verifyEmailedDocuments()
+ self.assertTrue(ingested_document.getRevision() > '1')
def playSequence(self, step_list, quiet):
sequence_list = SequenceList()
sequence_string = ' '.join(step_list)
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
-
+
+ def verifyEmailedDocuments(self):
+ """
+ Basic checks for verifying newly mailed-in document
+ """
+ # First, check document ingestion message
+ ingestion_message = self.portal_catalog.getResultValue(
+ portal_type='Document Ingestion Message',
+ title='A Test Mail',
+ source_title='John Doe')
+ self.assertTrue(ingestion_message is not None)
+
+ # Second, check attachments to ingested message
+ attachment_list = ingestion_message.getAggregateValueList()
+ self.assertEqual(len(attachment_list), 1)
+
+ # Third, check document is ingested properly
+ ingested_document = self.portal_catalog.getResultValue(
+ portal_type='Text',
+ reference='MAIL',
+ language='en',
+ version='002')
+ self.assertEquals('MAIL-en-002.doc', ingested_document.getSourceReference())
+ self.assertEquals('converted', ingested_document.getExternalProcessingState())
+ self.assertTrue('magic' in ingested_document.asText())
+
+ # check aggregate between 'Document Ingestion Message' and ingested document
+ self.assertEquals(attachment_list[0], ingested_document)
+ return attachment_list, ingested_document
+
##################################
## Tests
##################################
@@ -1278,7 +1298,10 @@
,'stepCreatePerson'
# now a known sender
,'stepReceiveEmail'
- ,'stepVerifyEmailedDocuments'
+ ,'stepVerifyEmailedDocumentsInitialContribution'
+ # send one more time
+ ,'stepReceiveEmail'
+ ,'stepVerifyEmailedDocumentsMultipleContribution'
]
self.playSequence(step_list, quiet)
More information about the Erp5-report
mailing list