Commit df4dafa5 authored by Gabriel Monnerat's avatar Gabriel Monnerat

the path of the scripts unoconverter and unomimemapper were defined in the...

the path of the scripts unoconverter and unomimemapper were defined in the configuration files, but when cloudooo is an egg, the buildout don't find these paths correctly. So, this modification is to obtain the paths dynamically and refactor cloudoooTestCase to load the configuration correctly.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@37415 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1c8a6239
......@@ -90,6 +90,9 @@ def application(global_config, **local_config):
document_url = path.join(path.dirname(__file__),
"tests/data/%s" % document_name)
cloudooo_path = path.abspath(path.dirname(__file__))
unoconverter_bin_path = path.join(cloudooo_path, "bin", "unoconverter.py")
unomimemapper_bin_path = path.join(cloudooo_path, "bin", "unomimemapper.py")
# Loading Configuration to start OOo Instance and control it
openoffice.loadSettings(application_hostname,
openoffice_port,
......@@ -98,9 +101,9 @@ def application(global_config, **local_config):
local_config.get('office_bin_path'),
local_config.get('uno_path'),
document_url=document_url,
unoconverter_bin=local_config.get('unoconverter_bin'),
unoconverter_bin=unoconverter_bin_path,
python_path=local_config.get('python_path'),
unomimemapper_bin=local_config.get('unomimemapper_bin'))
unomimemapper_bin=unomimemapper_bin_path)
openoffice.start()
monitor.load(local_config)
......@@ -112,14 +115,14 @@ def application(global_config, **local_config):
openoffice.acquire()
mimemapper.loadFilterList(application_hostname,
openoffice_port,
unomimemapper_bin=local_config.get('unomimemapper_bin'),
unomimemapper_bin=unomimemapper_bin_path,
python_path=local_config.get('python_path'))
openoffice.release()
from manager import Manager
timeout_response = int(local_config.get('timeout_response'))
kw = dict(timeout=timeout_response,
unoconverter_bin=local_config.get('unoconverter_bin'),
unoconverter_bin=unoconverter_bin_path,
python_path=local_config.get('python_path'))
cloudooo_manager = Manager(cloudooo_path_tmp_dir, **kw)
return WSGIXMLRPCApplication(instance=cloudooo_manager)
......@@ -45,13 +45,13 @@ def make_suite(test_case):
suite.addTest(unittest.makeSuite(test_case))
return suite
def loadConfig(path):
config.read(path)
def loadConfig(path=None):
conf_path = path or join(testcase_path, "..", "samples/cloudooo.conf")
config.read()
def startFakeEnvironment(start_openoffice=True, conf_path=None):
"""Create a fake environment"""
server_conf_path = conf_path or join(testcase_path, "..", "samples/cloudooo.conf")
loadConfig(server_conf_path)
loadConfig(conf_path)
uno_path = config.get("app:main", "uno_path")
path_dir_run_cloudooo = config.get("app:main", "path_dir_run_cloudooo")
virtual_display_id = int(config.get("app:main", "virtual_display_id"))
......@@ -115,6 +115,7 @@ class cloudoooTestCase(unittest.TestCase):
def setUp(self):
"""Creates a environment to run the tests. Is called always before the
tests."""
loadConfig()
self.hostname = config.get("server:main", "host")
self.cloudooo_port = config.get("server:main", "port")
self.openoffice_port = config.get("app:main", "openoffice_port")
......
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