Updated config & environment

This commit is contained in:
2025-09-16 08:39:00 +02:00
parent 5edabbf8c1
commit 5f25400bcd
134 changed files with 366 additions and 2233 deletions

View File

@@ -3,8 +3,8 @@ import unittest
from _socket import gethostname
from cpl.core.configuration import Configuration
from cpl.core.environment import ApplicationEnvironment, ApplicationEnvironmentABC
from cpl.core.environment import application_environment
from cpl.core.environment import Environment, EnvironmentABC
from cpl.core.environment import environment
class EnvironmentTestCase(unittest.TestCase):
@@ -13,15 +13,15 @@ class EnvironmentTestCase(unittest.TestCase):
self._env = self._config.environment
def test_app_env_created(self):
self.assertTrue(isinstance(self._env, ApplicationEnvironment))
self.assertTrue(issubclass(type(self._env), ApplicationEnvironmentABC))
self.assertTrue(isinstance(self._env, Environment))
self.assertTrue(issubclass(type(self._env), EnvironmentABC))
def test_app_env_values_correct_when_default(self):
self.assertEqual(self._env.environment_name, "production")
self.assertEqual(self._env.application_name, "")
self.assertEqual(self._env.customer, "")
self.assertEqual(self._env.host_name, gethostname())
self.assertEqual(self._env.working_directory, os.getcwd())
self.assertEqual(self._env.cwd, os.getcwd())
self.assertEqual(
self._env.runtime_directory,
os.path.dirname(os.path.dirname(os.path.abspath(application_environment.__file__))),
@@ -38,7 +38,7 @@ class EnvironmentTestCase(unittest.TestCase):
self.assertEqual(self._env.application_name, "Core Tests")
self.assertEqual(self._env.customer, "sh-edraft.de")
self.assertEqual(self._env.host_name, gethostname())
self.assertEqual(self._env.working_directory, os.getcwd())
self.assertEqual(self._env.cwd, os.getcwd())
self.assertEqual(
self._env.runtime_directory,
os.path.dirname(os.path.dirname(os.path.abspath(application_environment.__file__))),
@@ -46,7 +46,7 @@ class EnvironmentTestCase(unittest.TestCase):
def test_app_env_set_dirs(self):
new_cwd = os.path.join(os.getcwd(), "../")
self._env.set_working_directory(new_cwd)
self.assertEqual(self._env.working_directory, new_cwd)
self._env.set_cwd(new_cwd)
self.assertEqual(self._env.cwd, new_cwd)
self._env.set_runtime_directory(new_cwd)
self.assertEqual(self._env.runtime_directory, new_cwd)