refactor(routes): remove unused compatibility facades

This commit is contained in:
Dariusz L
2026-08-02 03:45:51 +02:00
parent 8eca219420
commit bb0e921511
5 changed files with 4 additions and 76 deletions
-12
View File
@@ -1,12 +0,0 @@
"""Compatibility exports for model information route registration."""
from .civitai_search import register_civitai_search_routes
from .context import RouteContext
from .custom_url import register_custom_url_routes
from .model_details import register_model_details_routes
def register_model_info_routes(context: RouteContext):
register_civitai_search_routes(context)
register_custom_url_routes(context)
register_model_details_routes(context)
-10
View File
@@ -1,10 +0,0 @@
"""Compatibility exports for search route registration."""
from .context import RouteContext
from .search_support import register_search_support_routes
from .source_search import register_source_search_routes
def register_search_routes(context: RouteContext):
register_source_search_routes(context)
register_search_support_routes(context)
-12
View File
@@ -1,12 +0,0 @@
"""Compatibility exports for workflow route registration."""
from .context import RouteContext
from .hashes import register_hash_routes
from .loaded_models import register_loaded_model_routes
from .workflow_analysis import register_workflow_analysis_routes
__all__ = ["register_loaded_model_routes", "register_workflow_routes"]
def register_workflow_routes(context: RouteContext):
register_workflow_analysis_routes(context)
register_hash_routes(context)
+3 -3
View File
@@ -15,9 +15,9 @@ the feature logic that powers each route.
5. Services in `core/services/` contain feature behavior and receive their
dependencies through `RouteContext`.
The grouping modules `core/routes/model_info.py`, `core/routes/search.py`, and
`core/routes/workflow.py` remain compatibility entry points for related route
families. The actual handlers live in focused route adapters and services.
Route registration imports the concrete route modules directly. The actual
handlers live in focused route adapters and services; no compatibility grouping
layer is kept for this application-only package.
## Adding a route
+1 -39
View File
@@ -7,7 +7,7 @@ from unittest.mock import AsyncMock, patch
import pytest
from aiohttp import web
from core.routes import base_models, model_info, search, workflow
from core.routes import base_models
class _Routes:
@@ -33,44 +33,6 @@ def _identity_endpoint(_name, **_kwargs):
return lambda handler: handler
def test_model_info_compatibility_registers_all_model_routes():
context = object()
with (
patch.object(model_info, "register_civitai_search_routes") as civitai,
patch.object(model_info, "register_custom_url_routes") as custom_url,
patch.object(model_info, "register_model_details_routes") as details,
):
model_info.register_model_info_routes(context)
civitai.assert_called_once_with(context)
custom_url.assert_called_once_with(context)
details.assert_called_once_with(context)
def test_search_compatibility_registers_source_and_support_routes():
context = object()
with (
patch.object(search, "register_source_search_routes") as sources,
patch.object(search, "register_search_support_routes") as support,
):
search.register_search_routes(context)
sources.assert_called_once_with(context)
support.assert_called_once_with(context)
def test_workflow_compatibility_registers_analysis_and_hash_routes():
context = object()
with (
patch.object(workflow, "register_workflow_analysis_routes") as analysis,
patch.object(workflow, "register_hash_routes") as hashes,
):
workflow.register_workflow_routes(context)
analysis.assert_called_once_with(context)
hashes.assert_called_once_with(context)
@pytest.mark.asyncio
async def test_base_model_routes_return_configured_data_and_status(monkeypatch):
routes = _Routes()