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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user