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:
Developer
2026-06-12 20:23:17 +00:00
parent 79be4eb525
commit 81b9a66ef5
35 changed files with 268 additions and 625 deletions
+7 -7
View File
@@ -4,11 +4,11 @@ from unittest.mock import MagicMock, patch
import logging
from src.services.docker import (
from src.services.docker.container import (
get_container_id,
get_container_name,
sort_volumes_by_specificity,
)
from src.services.docker.compose import sort_volumes_by_specificity
class TestGetContainerId:
@@ -16,15 +16,15 @@ class TestGetContainerId:
@patch("subprocess.run")
def test_lowercases_name_for_filter(self, mock_run) -> None:
"""Docker ps name filter is case-sensitive; we must lowercase."""
"""Docker inspect is case-sensitive; we must lowercase the name."""
mock_run.return_value = MagicMock(returncode=0, stdout="abc123\n")
result = get_container_id("MyContainer-ABC")
assert result == "abc123"
call_args = mock_run.call_args[0][0]
# The filter must use lowercase
assert "name=mycontainer-abc" in call_args
# Exact inspect call uses lowercase
assert call_args == ["docker", "inspect", "-f", "{{.Id}}", "mycontainer-abc"]
@patch("subprocess.run")
def test_returns_none_when_not_found(self, mock_run) -> None:
@@ -40,14 +40,14 @@ class TestGetContainerName:
@patch("subprocess.run")
def test_lowercases_name_for_filter(self, mock_run) -> None:
"""Docker ps name filter is case-sensitive; we must lowercase."""
"""Docker inspect is case-sensitive; we must lowercase the name."""
mock_run.return_value = MagicMock(returncode=0, stdout="mycontainer-abc\n")
result = get_container_name("MyContainer-ABC")
assert result == "mycontainer-abc"
call_args = mock_run.call_args[0][0]
assert "name=mycontainer-abc" in call_args
assert call_args == ["docker", "inspect", "-f", "{{.Name}}", "mycontainer-abc"]
@patch("subprocess.run")
def test_returns_none_when_not_found(self, mock_run) -> None: