{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/crawler\/tests\/integration\/conftest.py",
"old_string": "from src.infrastructure.config.db_config import load_db_settings\nfrom src.infrastructure.persistence.connection import MariaDbConnectionFactory\n\n_TRUNCATE_ORDER = (",
"new_string": "from src.infrastructure.config.db_config import load_db_settings\nfrom src.infrastructure.persistence.connection import MariaDbConnectionFactory\n\nTEST_DB = \"crawler_test\"\n\n_TRUNCATE_ORDER = (",
"replace_all": false
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/crawler\/tests\/integration\/conftest.py",
"oldString": "from src.infrastructure.config.db_config import load_db_settings\nfrom src.infrastructure.persistence.connection import MariaDbConnectionFactory\n\n_TRUNCATE_ORDER = (",
"newString": "from src.infrastructure.config.db_config import load_db_settings\nfrom src.infrastructure.persistence.connection import MariaDbConnectionFactory\n\nTEST_DB = \"crawler_test\"\n\n_TRUNCATE_ORDER = (",
"originalFile": "from __future__ import annotations\n\nfrom collections.abc import Generator\n\nimport pytest\n\nfrom src.infrastructure.config.db_config import load_db_settings\nfrom src.infrastructure.persistence.connection import MariaDbConnectionFactory\n\n_TRUNCATE_ORDER = (\n \"url_queue\",\n \"external_checks\",\n \"errors\",\n \"js_errors\",\n \"hreflang\",\n \"structured_data\",\n \"resources\",\n \"images\",\n \"links\",\n \"page_headers\",\n \"pages\",\n \"urls\",\n \"crawls\",\n)\n\n\n@pytest.fixture\ndef connection_factory() -> MariaDbConnectionFactory:\n return MariaDbConnectionFactory(load_db_settings(\"crawler\"))\n\n\n@pytest.fixture(autouse=True)\ndef _clean_crawler_db(\n connection_factory: MariaDbConnectionFactory,\n) -> Generator[None, None, None]:\n _truncate(connection_factory)\n yield\n _truncate(connection_factory)\n\n\ndef _truncate(factory: MariaDbConnectionFactory) -> None:\n with factory.session() as conn:\n cur = conn.cursor()\n cur.execute(\"SET FOREIGN_KEY_CHECKS=0\")\n for table in _TRUNCATE_ORDER:\n cur.execute(f\"TRUNCATE TABLE {table}\")\n cur.execute(\"SET FOREIGN_KEY_CHECKS=1\")\n",
"structuredPatch": [
{
"oldStart": 7,
"oldLines": 6,
"newStart": 7,
"newLines": 8,
"lines": [
" from src.infrastructure.config.db_config import load_db_settings",
" from src.infrastructure.persistence.connection import MariaDbConnectionFactory",
" ",
"+TEST_DB = \"crawler_test\"",
"+",
" _TRUNCATE_ORDER = (",
" \"url_queue\",",
" \"external_checks\","
]
}
],
"userModified": false,
"replaceAll": false
}
}