fix: resolve stale backend test imports and schema drift
- Delete 4 obsolete unit tests tied to removed git mount/clone models - Update imports and assertions across unit/integration/service tests - Fix Settings defaults (postgres host, JWT props, cookie_samesite) - Add skip guards for PostgreSQL-dependent integration tests - Fix GitService env assertions and HealthMonitor state-change tests - Repair docker/container inspect assertions in test_docker_service - Fix ToolTypeCreate default_port validator ordering bug - Fix check_port_exposed substring false-positive for port 0 - Update test_tool_types_api_extended to use interface_type field Quality gates: pytest 311 passed, 34 skipped; npm typecheck/lint/test 87 passed
This commit is contained in:
@@ -10,7 +10,30 @@ from sqlalchemy.ext.asyncio import create_async_engine
|
||||
from src.auth.session import create_session_cookie
|
||||
from src.config import Settings, build_database_url
|
||||
from src.models import Base
|
||||
from src.models.user import User
|
||||
from src.models.user.user import User
|
||||
|
||||
|
||||
def _postgres_available() -> bool:
|
||||
"""Check whether a PostgreSQL server is reachable for integration tests."""
|
||||
import asyncpg
|
||||
|
||||
async def _check() -> bool:
|
||||
try:
|
||||
conn = await asyncpg.connect(
|
||||
host="localhost", port=5432, user="headquarter", password="headquarter", database="headquarter"
|
||||
)
|
||||
await conn.close()
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
return asyncio.run(_check())
|
||||
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
not _postgres_available(),
|
||||
reason="PostgreSQL not available on localhost:5432",
|
||||
)
|
||||
|
||||
|
||||
def _prepare_auth_test_db() -> None:
|
||||
@@ -34,7 +57,7 @@ def _prepare_auth_test_db() -> None:
|
||||
|
||||
def _load_app():
|
||||
import src.database as database_module
|
||||
import src.api.auth as auth_module
|
||||
import src.api.user.auth as auth_module
|
||||
import src.main as main_module
|
||||
|
||||
importlib.reload(database_module)
|
||||
|
||||
Reference in New Issue
Block a user