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