Commit 0bdcefd4 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor to be able to pass the configuration dynamically

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@37608 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 93cebd5a
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
############################################################################## ##############################################################################
import unittest import unittest
from sys import path from sys import path, argv
from ConfigParser import ConfigParser from ConfigParser import ConfigParser
from os.path import join, exists, dirname from os.path import join, exists, dirname
from os import environ, putenv from os import environ, putenv
...@@ -45,12 +45,13 @@ def make_suite(test_case): ...@@ -45,12 +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=None): def loadConfig(path):
conf_path = path or join(testcase_path, "..", "samples/cloudooo.conf") config.read(path)
config.read(conf_path)
def startFakeEnvironment(start_openoffice=True, conf_path=None): def startFakeEnvironment(start_openoffice=True, conf_path=None):
"""Create a fake environment""" """Create a fake environment"""
if not conf_path and len(argv) >=1:
conf_path = argv[1]
loadConfig(conf_path) loadConfig(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")
...@@ -115,7 +116,6 @@ class cloudoooTestCase(unittest.TestCase): ...@@ -115,7 +116,6 @@ 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