[Erp5-report] r43524 gabriel - in /erp5/trunk/utils/cloudooo/cloudooo/handler: pdf/ pdf/tes...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Feb 21 15:05:25 CET 2011


Author: gabriel
Date: Mon Feb 21 15:05:25 2011
New Revision: 43524

URL: http://svn.erp5.org?rev=43524&view=rev
Log:
load env-PATH in HandlerTestCase and pass it to PDFHandler as env

Modified:
    erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py
    erp5/trunk/utils/cloudooo/cloudooo/handler/tests/handlerTestCase.py

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py?rev=43524&r1=43523&r2=43524&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/handler.py [utf8] Mon Feb 21 15:05:25 2011
@@ -48,7 +48,6 @@ class PDFHandler(object):
     """ Convert a pdf document """
     output_url = mktemp(suffix=".%s" % destination_format,
                         dir=self.document.directory_name)
-    # XXX - refactor to use the binary provided by erp5 buildout
     command = ["pdftotext", self.document.getUrl(), output_url]
     stdout, stderr = Popen(command,
                            stdout=PIPE,
@@ -63,7 +62,6 @@ class PDFHandler(object):
     """Returns a dictionary with all metadata of document.
     along with the metadata.
     """
-    # XXX - refactor to use the binary provided by erp5 buildout
     command = ["pdfinfo", self.document.getUrl()]
     stdout, stderr = Popen(command,
                            stdout=PIPE,

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py?rev=43524&r1=43523&r2=43524&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/pdf/tests/testPDFHandler.py [utf8] Mon Feb 21 15:05:25 2011
@@ -35,17 +35,20 @@ from types import DictType
 
 class TestPDFHandler(HandlerTestCase):
 
+  def afterSetUp(self):
+    self.kw = dict(env=dict(PATH=self.env_path))
+
   def testConvertPDFtoText(self):
     """Test conversion of pdf to txt"""
     pdf_document = open("data/test.pdf").read()
-    handler = PDFHandler(self.tmp_url, pdf_document, "pdf")
+    handler = PDFHandler(self.tmp_url, pdf_document, "pdf", **self.kw)
     txt_document = handler.convert("txt")
     self.assertTrue(txt_document.startswith("UNG Docs Architecture"))
 
   def testgetMetadata(self):
     """Test if the metadata are extracted correctly"""
     pdf_document = open("data/test.pdf").read()
-    handler = PDFHandler(self.tmp_url, pdf_document, "pdf")
+    handler = PDFHandler(self.tmp_url, pdf_document, "pdf", **self.kw)
     metadata = handler.getMetadata()
     self.assertEquals(type(metadata), DictType)
     self.assertNotEquals(metadata, {})

Modified: erp5/trunk/utils/cloudooo/cloudooo/handler/tests/handlerTestCase.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo/cloudooo/handler/tests/handlerTestCase.py?rev=43524&r1=43523&r2=43524&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo/cloudooo/handler/tests/handlerTestCase.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo/cloudooo/handler/tests/handlerTestCase.py [utf8] Mon Feb 21 15:05:25 2011
@@ -56,6 +56,7 @@ class HandlerTestCase(unittest.TestCase)
     self.openoffice_port = config.get("app:main", "openoffice_port")
     self.office_binary_path = config.get("app:main", "office_binary_path")
     self.python_path = sys.executable
+    self.env_path = config.get("app:main", "env-path")
     self.working_path = config.get("app:main", "working_path")
     self.tmp_url = path.join(self.working_path, "tmp")
     check_folder(self.working_path, self.tmp_url)



More information about the Erp5-report mailing list