🧹 refactor(db): remover compatibilidade temporaria de multas

main
parent 9182ec29a3
commit 498836fd38

@ -513,11 +513,6 @@ def seed_tools():
try:
repo = ToolRepository(db)
existing = repo.get_all()
obsolete_tool_names = {"registrar_multa_aluguel"}
for tool in existing:
if tool.name in obsolete_tool_names:
repo.delete(tool.id)
existing = repo.get_all()
existing_names = {t.name for t in existing}
for tool_def in get_tools_definitions():
if tool_def["name"] in existing_names:

@ -1,12 +1,10 @@
import unittest
from types import SimpleNamespace
from unittest.mock import AsyncMock, patch
from app import main as main_module
from app.core.settings import Settings
from app.db import bootstrap as bootstrap_module
from app.db import init_db as init_db_module
from app.db import tool_seed as tool_seed_module
class SettingsParsingTests(unittest.TestCase):
@ -83,45 +81,6 @@ class BootstrapRuntimeTests(unittest.TestCase):
bootstrap_databases.assert_called_once_with()
class ToolSeedTests(unittest.TestCase):
def test_seed_tools_remove_tool_legada_de_multa(self):
class FakeToolRepo:
def __init__(self, tools):
self.tools = list(tools)
self.deleted_ids = []
def get_all(self):
return list(self.tools)
def delete(self, tool_id):
self.deleted_ids.append(tool_id)
self.tools = [tool for tool in self.tools if tool.id != tool_id]
def update_by_name(self, **kwargs):
return kwargs
def create(self, **kwargs):
return kwargs
repo = FakeToolRepo(
[
SimpleNamespace(id=1, name="registrar_multa_aluguel"),
SimpleNamespace(id=2, name="consultar_estoque"),
]
)
fake_db = SimpleNamespace(close=lambda: None)
with patch.object(tool_seed_module, "SessionLocal", return_value=fake_db), patch.object(
tool_seed_module,
"ToolRepository",
return_value=repo,
):
tool_seed_module.seed_tools()
self.assertEqual(repo.deleted_ids, [1])
self.assertFalse(any(tool.name == "registrar_multa_aluguel" for tool in repo.get_all()))
class HttpStartupTests(unittest.IsolatedAsyncioTestCase):
async def test_startup_event_warms_llm_without_running_bootstrap(self):
with patch("app.main.LLMService") as llm_cls, patch(

Loading…
Cancel
Save