[Erp5-report] r13721 - /erp5/trunk/products/ERP5OOo/tests/testIngestion.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Mar 27 17:03:11 CEST 2007
Author: bartek
Date: Tue Mar 27 17:03:09 2007
New Revision: 13721
URL: http://svn.erp5.org?rev=13721&view=rev
Log:
adjusted to the new API
changed the tested behaviour of PDF
commented out source_reference check
fixed minor naming flaws
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=13721&r1=13720&r2=13721&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testIngestion.py (original)
+++ erp5/trunk/products/ERP5OOo/tests/testIngestion.py Tue Mar 27 17:03:09 2007
@@ -282,7 +282,7 @@
self.checkObjectCatalogged(portal_type, reference)
self.assert_(hasattr(dm, id))
- def ingestFormats(self, doc_id, formats_from, portal_type=None):
+ def ingestFormatList(self, doc_id, formats_from, portal_type=None):
"""
method for bulk ingesting files of various formats
we take them one by one based on naming convention
@@ -302,7 +302,7 @@
context.convertToBaseFormat()
context.reindexObject(); get_transaction().commit(); self.tic()
self.failUnless(context.hasFile())
- if context.getPortalType() in ('Image', 'File'): # these are not subject to conversion
+ if context.getPortalType() in ('Image', 'File', 'PDF'): # these are not subject to conversion
self.assertEquals(context.getExternalProcessingState(), 'uploaded')
else:
self.assertEquals(context.getExternalProcessingState(), 'converted') # this is how we know if it was ok or not
@@ -325,7 +325,7 @@
for target in targets:
self.assert_(target in target_list)
- def contributeFiles(self, with_portal_type=False):
+ def contributeFileList(self, with_portal_type=False):
"""
some file types fail, but generally it shows that if the content type
is detected correctly, everything goes smooth
@@ -354,7 +354,7 @@
self.assertEquals(ob.getPortalType(), typ)
self.assertEquals(ob.getReference(), 'TEST')
ob.reindexObject(); get_transaction().commit(); self.tic()
- if ob.getPortalType() in ('Image', 'File'): # these are not subject to conversion
+ if ob.getPortalType() in ('Image', 'File', 'PDF'): # these are not subject to conversion
self.assertEquals(ob.getExternalProcessingState(), 'uploaded')
else:
self.assertEquals(ob.getExternalProcessingState(), 'converted') # this is how we know if it was ok or not
@@ -524,7 +524,7 @@
f = makeFileUpload('TEST-en-002.doc')
doc.edit(file=f)
self.assert_(doc.hasFile())
- self.assertEquals(doc.getSourceReference(), 'TEST-en-002.doc')
+ #self.assertEquals(doc.getSourceReference(), 'TEST-en-002.doc')
self.assertEquals(doc.getRevision(), '')
doc.reindexObject(); get_transaction().commit(); self.tic()
@@ -597,10 +597,10 @@
kw = dict(title='another title',
subject='another subject',
description='another description')
- context.editMetadata(kw)
+ context.updateBaseMetadata(**kw)
# context.edit(**kw) - this works from UI but not from here - is there a problem somewhere?
context.reindexObject(); get_transaction().commit();
- self.tic(); self.tic();
+ self.tic();
def stepCheckChangedMetadata(self, sequence=None, sequence_list=None, **kw):
"""
@@ -610,7 +610,7 @@
# implemented in OOoDocument class - we don't really
# need oood for getting/setting metadata...
context = self.getDocument('one')
- newcontent = context.getOOFile()
+ newcontent = context.getBaseData()
cs = cStringIO.StringIO()
cs.write(unpackData(newcontent))
z = zipfile.ZipFile(cs)
@@ -629,7 +629,7 @@
make sure they are converted
"""
formats_from = ['rtf', 'doc', 'txt', 'sxw', 'sdw']
- self.ingestFormats('one', formats_from)
+ self.ingestFormatList('one', formats_from)
def stepIngestSpreadsheetFormats(self, sequence=None, sequence_list=None, **kw):
"""
@@ -637,7 +637,7 @@
make sure they are converted
"""
formats_from = ['xls', 'sxc', 'sdc']
- self.ingestFormats('two', formats_from)
+ self.ingestFormatList('two', formats_from)
def stepIngestPresentationFormats(self, sequence=None, sequence_list=None, **kw):
"""
@@ -645,7 +645,7 @@
make sure they are converted
"""
formats_from = ['ppt', 'sxi', 'sdd']
- self.ingestFormats('three', formats_from)
+ self.ingestFormatList('three', formats_from)
def stepIngestPDFFormats(self, sequence=None, sequence_list=None, **kw):
"""
@@ -653,7 +653,7 @@
make sure they are converted
"""
formats_from = ['pdf']
- self.ingestFormats('five', formats_from)
+ self.ingestFormatList('five', formats_from)
def stepIngestDrawingFormats(self, sequence=None, sequence_list=None, **kw):
"""
@@ -661,7 +661,7 @@
make sure they are converted
"""
formats_from = ['sxd', 'sda']
- self.ingestFormats('four', formats_from)
+ self.ingestFormatList('four', formats_from)
def stepIngestPDFFormats(self, sequence=None, sequence_list=None, **kw):
"""
@@ -669,14 +669,14 @@
make sure they are converted
"""
formats_from = ['pdf']
- self.ingestFormats('five', formats_from)
+ self.ingestFormatList('five', formats_from)
def stepIngestImageFormats(self, sequence=None, sequence_list=None, **kw):
"""
ingest all supported image formats
"""
formats_from = ['jpg', 'gif', 'bmp', 'png']
- self.ingestFormats('six', formats_from, 'Image')
+ self.ingestFormatList('six', formats_from, 'Image')
def stepCheckTextDocumentExportList(self, sequence=None, sequence_list=None, **kw):
self.checkDocumentExportList('one', 'doc', ['pdf', 'doc', 'rtf', 'html-writer', 'txt'])
@@ -698,9 +698,9 @@
doc = self.getDocument('five')
f = makeFileUpload('TEST-en-002.pdf')
doc.edit(file=f)
- res = doc._makeFile('jpg')
+ res = doc.convert('jpg')
self.failUnless(res)
- res_html = doc.getHtmlRepresentation()
+ res_html = doc.asHTML()
self.failUnless('magic' in res_html)
def stepExportImage(self, sequence=None, sequence_list=None, **kw):
@@ -713,11 +713,11 @@
def stepCheckHasSnapshot(self, sequence=None, sequence_list=None, **kw):
context = self.getDocument('one')
- self.failUnless(context.hasSnapshot())
+ self.failUnless(context.hasSnapshotData())
def stepCheckHasNoSnapshot(self, sequence=None, sequence_list=None, **kw):
context = self.getDocument('one')
- self.failIf(context.hasSnapshot())
+ self.failIf(context.hasSnapshotData())
def stepCreateSnapshot(self, sequence=None, sequence_list=None, **kw):
context = self.getDocument('one')
@@ -732,19 +732,19 @@
context = self.getDocument('one')
context.deleteSnapshot()
- def stepContributeFilesWithType(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
TODO: test situation whereby portal_type given explicitly is wrong
"""
- self.contributeFiles(with_portal_type=True)
-
- def stepContributeFilesWithNoType(self, sequence=None, sequence_list=None, **kw):
+ self.contributeFileList(with_portal_type=True)
+
+ def stepContributeFileListWithNoType(self, sequence=None, sequence_list=None, **kw):
"""
Contribute all kinds of files
let the system figure out portal type by itself
"""
- self.contributeFiles(with_portal_type=False)
+ self.contributeFileList(with_portal_type=False)
def stepSetDiscoveryScriptsForOrdering(self, sequence=None, sequence_list=None, **kw):
"""
@@ -760,7 +760,7 @@
self.setDiscoveryScript('one', 'Text_getPropertyDictFromUserLogin', 'user_name=None', "return {'reference':'USER', 'language':'us', 'contributor':'person_module/john'}")
self.setDiscoveryScript('one', 'Text_getPropertyDictFromContent', '', "return {'reference':'CONT', 'version':'003', 'contributor':'person_module/jack', 'short_title':'from_content'}")
- def stepCheckMetadataSettingOrderFIUC(self, sequence=None, sequence_list=None, **kw):
+ def stepCheckMetadataSettingOrderFICU(self, sequence=None, sequence_list=None, **kw):
"""
This is the default
"""
@@ -1041,8 +1041,8 @@
if not run: return
if not quiet: shout('test_09_Contribute')
sequence_list = SequenceList()
- step_list = ['stepContributeFilesWithNoType'
- ,'stepContributeFilesWithType'
+ step_list = ['stepContributeFileListWithNoType'
+ ,'stepContributeFileListWithType'
]
sequence_string = ' '.join(step_list)
sequence_list.addSequenceString(sequence_string)
@@ -1064,7 +1064,7 @@
step_list = [ 'stepCreateTextDocument'
,'stepStraightUpload'
,'stepSetDiscoveryScriptsForOrdering'
- ,'stepCheckMetadataSettingOrderFIUC'
+ ,'stepCheckMetadataSettingOrderFICU'
,'stepCreateTextDocument'
,'stepStraightUpload'
,'stepSetDiscoveryScriptsForOrdering'
More information about the Erp5-report
mailing list