refactor: split LDAP auth into backend/routers/auth.py

This commit is contained in:
2026-04-19 12:35:40 +03:00
parent a520b1ba2b
commit 90e9a60640
5 changed files with 363 additions and 339 deletions

View File

@@ -14,6 +14,7 @@ from backend.models import User
from backend.config_manager import ConfigManager
from backend.auth import get_current_admin, TokenData
import backend.routers.users as users_router
import backend.routers.auth as auth_router
import backend.routers.categories as categories_router
@@ -84,8 +85,8 @@ def test_client(test_db: Session) -> Generator[TestClient, None, None]:
@pytest.fixture(scope="function")
def mock_ldap() -> Generator[MagicMock, None, None]:
"""Mock LDAP authentication."""
with patch("backend.routers.users.ldap3.Server") as mock_server, \
patch("backend.routers.users.ldap3.Connection") as mock_conn_class:
with patch("backend.routers.auth.ldap3.Server") as mock_server, \
patch("backend.routers.auth.ldap3.Connection") as mock_conn_class:
mock_conn = MagicMock()
mock_conn.bind.return_value = True