test: final 6 agents — 172+ translate tests, llm_analysis 89%, git_plugin 100%, migration/deps/routes polished. 85-94% files pushed to 95%+. Bulk: backup/debug/maintenance plugins

This commit is contained in:
2026-06-15 22:04:40 +03:00
parent 8995d7beae
commit 7010c40102
35 changed files with 7811 additions and 49 deletions

View File

@@ -190,4 +190,29 @@ class TestRouterRegistration:
assert "/api/git" in routes or "/api/mappings" in routes
assert "/ws/logs/" in routes
assert "/ws/task-events" in routes
class TestAlembicMigrations:
"""run_alembic_migrations — test happy path and error path."""
def test_run_alembic_migrations_success(self):
"""Alembic migrations apply successfully (lines 205-213)."""
from src.app import run_alembic_migrations
with patch("alembic.command.upgrade") as mock_upgrade, \
patch("alembic.config.Config") as mock_cfg_cls:
mock_cfg = MagicMock()
mock_cfg_cls.return_value = mock_cfg
run_alembic_migrations()
mock_upgrade.assert_called_once_with(mock_cfg, "head")
def test_run_alembic_migrations_failure(self):
"""Alembic migration failure raises (lines 214-219)."""
from src.app import run_alembic_migrations
with patch("alembic.command.upgrade", side_effect=Exception("Migration failed")) as mock_upgrade, \
patch("alembic.config.Config") as mock_cfg_cls:
mock_cfg = MagicMock()
mock_cfg_cls.return_value = mock_cfg
with pytest.raises(Exception, match="Migration failed"):
run_alembic_migrations()
mock_upgrade.assert_called_once_with(mock_cfg, "head")
# #endregion Test.AppModule.Middleware