mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Fix to return only enabled content types via the new config/types API
- Previously was return all core content types even if they had not been setup - Add test to validate only configured content types are returned by the api/config/types API endpoint
This commit is contained in:
parent
b177adf3a7
commit
b09350c052
2 changed files with 11 additions and 1 deletions
|
@ -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()
|
||||
]
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue