From 2344a84411f67e58db1d4014f62a7a7f159aa134 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Sun, 9 Feb 2025 18:23:24 +0100 Subject: [PATCH] Unit tests: loading additional RDHD configuration --- tests/config/valid_rhdh_config.yaml | 4 +++- tests/unit/utils/test_config.py | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/config/valid_rhdh_config.yaml b/tests/config/valid_rhdh_config.yaml index 32f9f515..8b8dc820 100644 --- a/tests/config/valid_rhdh_config.yaml +++ b/tests/config/valid_rhdh_config.yaml @@ -82,4 +82,6 @@ lightspeed: servers: - id: ollama url: http://localhost:11434/v1 - token: dummy-token \ No newline at end of file + token: dummy-token + models: + - name: model-one diff --git a/tests/unit/utils/test_config.py b/tests/unit/utils/test_config.py index 0a27516c..deb6429c 100644 --- a/tests/unit/utils/test_config.py +++ b/tests/unit/utils/test_config.py @@ -1451,6 +1451,19 @@ def test_missing_additional_config_file(): config.reload_additional_config_file("/dev/null/non-existent", "") +def test_loading_additional_config_file_rhdh_type(): + """Check how an additional configuration file is handled.""" + config.reload_additional_config_file("tests/config/valid_rhdh_config.yaml", "rhdh") + + +def test_loading_incorrect_additional_config_file_rhdh_type(): + """Check how an incorrect additional configuration file is handled.""" + with pytest.raises(KeyError, match="No lightspeed configuration defined"): + config.reload_additional_config_file( + "tests/config/invalid_rhdh_config.yaml", "rhdh" + ) + + def test_additional_config_file_incorrect_type(): """Check how an additional configuration file is handled with an incorrect type.""" with pytest.raises(