Skip to content

Commit

Permalink
[FIX] server_environment: test independent from the working env
Browse files Browse the repository at this point in the history
  • Loading branch information
florentx committed Oct 29, 2024
1 parent 3a6f9fe commit 6a44e4b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server_environment/tests/test_environment_variable.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright 2018 Camptocamp (https://www.camptocamp.com).
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)


from unittest.mock import patch

from odoo.tools.config import config as odoo_config
Expand All @@ -10,10 +9,19 @@

from .common import ServerEnvironmentCase

CLEAN_ENV = {
var: value
for (var, value) in os.environ.items()
if var not in ("RUNNING_ENV", "ODOO_STAGE")
}


class TestRunningEnvDefault(ServerEnvironmentCase):
@patch.dict("os.environ", CLEAN_ENV, clear=True)
@patch.dict(odoo_config.options, {"running_env": None})
def test_running_env_default(self):
"""When var is not provided it defaults to `test`."""
server_env._load_running_env()
self.assertEqual(odoo_config["running_env"], "test")


Expand Down

0 comments on commit 6a44e4b

Please sign in to comment.