Commit a6797e4b authored by Alexis PASQUIER's avatar Alexis PASQUIER
Browse files

Fix unittest

parent b5a4a90b
Pipeline #81826 passed with stages
in 1 minute and 47 seconds
......@@ -181,6 +181,9 @@ class DatabaseOdooConfigSection(OdooConfigSection):
self.filter = self.name
if self.name and self.show and not self.filter:
self.filter = self.name + ".*"
if not self.host or not self.name or not self.user or not self.password:
self.enable = False
return self
def _get_conn_mode(self, env_vars):
......@@ -212,9 +215,6 @@ class HttpOdooConfigSection(OdooConfigSection):
def __init__(self, odoo_config_maker: OdooConfigABC) -> None:
super().__init__(odoo_config_maker)
self.enable = True
self.interface = None
self.port = None
self.longpolling_port = None
self.key_http = "http" if self.config_maker.odoo_version > 10 else "xmlrpc"
self.disable_dict = {"--no-%s" % self.key_http: True}
self.interface = "0.0.0.0"
......
......@@ -10,18 +10,15 @@ class TestOdooConfig(unittest.TestCase):
config = OdooConfig(odoo_version=16, odoo_rc="/tmp/odoo_rc.ini", main_instance=True)
config.load_registry(Registry)
config.populate_all_section(env_vars={"REMOTE_DB": str(False)})
result = config.to_dict()
print(result)
expected = {
"--config": "/tmp/odoo_rc.ini",
"--http-interface": "0.0.0.0",
"--http-port": 8080,
"--longpolling-port": 4040,
"--unaccent": False,
"--test-enable": False,
"--config=/tmp/odoo_rc.ini",
"--http-interface=0.0.0.0",
"--http-port=8080",
"--longpolling-port=4040",
"--unaccent",
"--without-demo=all",
"--max-cron-threads=2",
"--load=base,web",
"--workers=1",
}
for key, value in expected.items():
self.assertIn(key, result)
self.assertEqual(value, result[key], "key [%s] expected => %s got => %s" % (key, value, result.get(key)))
result.pop(key)
self.assertFalse(result)
self.assertSetEqual(expected, set(config.to_odoo_args()))
......@@ -179,13 +179,9 @@ class Test_WebLauncher(base_test.TestLauncherPatched):
self.assertListEqual(
[
"/usr/bin/python3",
"/my/path/to/odoo/odoo-bin",
f"--addons-path={api.AbstractLauncher.server_path}",
"ndpserver",
"--config=/tmp/odoo_rc.ini",
],
launcher.normalize_args(config),
config.to_odoo_args(),
)
def test_WebLauncherDepends(self):
......
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