Update integration tests for application_config
This commit is contained in:
parent
7e4ec53d78
commit
ec27b7d5c5
2 changed files with 9 additions and 2 deletions
|
|
@ -33,7 +33,10 @@ def test_env():
|
||||||
"""Yield a server with a very basic configuration."""
|
"""Yield a server with a very basic configuration."""
|
||||||
with open(SIM_CONFIG, "r", encoding="utf-8") as f_obj:
|
with open(SIM_CONFIG, "r", encoding="utf-8") as f_obj:
|
||||||
config_dict = json.load(f_obj)
|
config_dict = json.load(f_obj)
|
||||||
with LabThingsTestEnv(things=config_dict["things"]) as env:
|
with LabThingsTestEnv(
|
||||||
|
things=config_dict["things"],
|
||||||
|
application_config=config_dict["application_config"],
|
||||||
|
) as env:
|
||||||
yield env
|
yield env
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ class LabThingsTestEnv:
|
||||||
self,
|
self,
|
||||||
things: Mapping[str, lt.Thing | str],
|
things: Mapping[str, lt.Thing | str],
|
||||||
settings_folder: Optional[str] = None,
|
settings_folder: Optional[str] = None,
|
||||||
|
application_config: Optional[Mapping[str, Any]] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialise the test environment.
|
"""Initialise the test environment.
|
||||||
|
|
||||||
|
|
@ -47,6 +48,7 @@ class LabThingsTestEnv:
|
||||||
self._test_client: Optional[TestClient]
|
self._test_client: Optional[TestClient]
|
||||||
self._things_config = things
|
self._things_config = things
|
||||||
self._settings_folder = settings_folder
|
self._settings_folder = settings_folder
|
||||||
|
self._application_config = application_config
|
||||||
self._tmp_dir_obj: Optional[tempfile.TemporaryDirectory] = None
|
self._tmp_dir_obj: Optional[tempfile.TemporaryDirectory] = None
|
||||||
|
|
||||||
def __enter__(self) -> Self:
|
def __enter__(self) -> Self:
|
||||||
|
|
@ -55,7 +57,9 @@ class LabThingsTestEnv:
|
||||||
self._tmp_dir_obj = tempfile.TemporaryDirectory()
|
self._tmp_dir_obj = tempfile.TemporaryDirectory()
|
||||||
self._settings_folder = self._tmp_dir_obj.name
|
self._settings_folder = self._tmp_dir_obj.name
|
||||||
self._server = lt.ThingServer(
|
self._server = lt.ThingServer(
|
||||||
things=self._things_config, settings_folder=self._settings_folder
|
things=self._things_config,
|
||||||
|
settings_folder=self._settings_folder,
|
||||||
|
application_config=self._application_config,
|
||||||
)
|
)
|
||||||
self._test_client = TestClient(self._server.app)
|
self._test_client = TestClient(self._server.app)
|
||||||
self._test_client.__enter__()
|
self._test_client.__enter__()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue