diff --git a/src/khoj/routers/api.py b/src/khoj/routers/api.py index ad6d9919..b9f2a3b8 100644 --- a/src/khoj/routers/api.py +++ b/src/khoj/routers/api.py @@ -32,7 +32,7 @@ def get_config_types(): return [ search_type.value for search_type in SearchType - if any(search_type.value == configured_content_type[0] for configured_content_type in state.config.content_type) + if any(search_type.value == ctype[0] and ctype[1] for ctype in state.config.content_type) or search_type.name in state.config.content_type.plugins.keys() ] diff --git a/tests/test_client.py b/tests/test_client.py index 95e31048..c9510c82 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -76,6 +76,16 @@ def test_regenerate_with_valid_content_type(client): assert response.status_code == 200 +# ---------------------------------------------------------------------------------------------------- +def test_get_configured_types_via_api(client): + # Act + response = client.get(f"/api/config/types") + + # Assert + assert response.status_code == 200 + assert response.json() == ["org", "image", "plugin1"] + + # ---------------------------------------------------------------------------------------------------- def test_image_search(client, content_config: ContentConfig, search_config: SearchConfig): # Arrange