Commit 144cc15d authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor to remove the static temporary folder. If the folder not exists, one is created

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@37869 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cac3f56e
...@@ -73,7 +73,7 @@ class TestAllFormats(cloudoooTestCase): ...@@ -73,7 +73,7 @@ class TestAllFormats(cloudoooTestCase):
data_output = self.proxy.convertFile(encodestring(data), data_output = self.proxy.convertFile(encodestring(data),
source_format, source_format,
extension[0]) extension[0])
output_file_url = 'output/test_%s.%s' % (document_type, extension[0]) output_file_url = '%s/test_%s.%s' % (self.tmp_url, document_type, extension[0])
open(output_file_url, 'w').write(decodestring(data_output)) open(output_file_url, 'w').write(decodestring(data_output))
stdout, stderr = Popen("file %s" % output_file_url, stdout, stderr = Popen("file %s" % output_file_url,
shell=True, shell=True,
......
...@@ -39,17 +39,16 @@ class TestHighLoad(cloudoooTestCase): ...@@ -39,17 +39,16 @@ class TestHighLoad(cloudoooTestCase):
def afterSetUp(self): def afterSetUp(self):
"""Creates connection with cloudooo Server""" """Creates connection with cloudooo Server"""
self.output_folder = "output"
self.proxy = ServerProxy("http://%s:%s" % (self.hostname, self.cloudooo_port)) self.proxy = ServerProxy("http://%s:%s" % (self.hostname, self.cloudooo_port))
def basicTestToGenerate(self, id, data, source_format, destination_format): def basicTestToGenerate(self, id, data, source_format, destination_format):
"""Test to use method generate of server""" """Test to use method generate of server"""
document = self.proxy.convertFile(data, source_format, destination_format) document = self.proxy.convertFile(data, source_format, destination_format)
document_output_url = os.path.join(self.output_folder,"%s.%s" % (id, destination_format)) document_output_url = os.path.join(self.tmp_url, "%s.%s" % (id, destination_format))
open(document_output_url,'wb').write(decodestring(document)) open(document_output_url,'wb').write(decodestring(document))
stdout, stderr = subprocess.Popen("file %s" % document_output_url, stdout, stderr = subprocess.Popen("file -b %s" % document_output_url,
shell=True, stdout=subprocess.PIPE).communicate() shell=True, stdout=subprocess.PIPE).communicate()
self.assertEquals(stdout, 'output/%s.pdf: PDF document, version 1.4\n' % id) self.assertEquals(stdout, 'PDF document, version 1.4\n')
self.assertEquals(stderr, None) self.assertEquals(stderr, None)
os.remove(document_output_url) os.remove(document_output_url)
self.assertEquals(os.path.exists(document_output_url), False) self.assertEquals(os.path.exists(document_output_url), False)
......
This diff is collapsed.
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