{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/mcp-servers\/mcp-db\/tests\/test_config.py",
"content": "#!\/usr\/bin\/env python3\n\"\"\"Tests für Konfiguration\"\"\"\n\nimport sys\nfrom pathlib import Path\n\nimport pytest\n\nsys.path.insert(0, \"\/opt\/mcp-servers\/mcp-db\")\n\nfrom dotenv import load_dotenv\n\nload_dotenv(Path(\"\/opt\/mcp-servers\/mcp-db\/.env\"))\n\nfrom config import Config\n\n\nclass TestConfig:\n \"\"\"Test Konfiguration\"\"\"\n\n def test_allowed_databases(self):\n \"\"\"Test: ALLOWED_DATABASES korrekt\"\"\"\n assert \"ki_protokoll\" in Config.ALLOWED_DATABASES\n assert \"ki_system\" in Config.ALLOWED_DATABASES\n assert \"mysql\" not in Config.ALLOWED_DATABASES\n\n def test_blocked_keywords(self):\n \"\"\"Test: BLOCKED_KEYWORDS enthält kritische Keywords\"\"\"\n required_keywords = [\n \"DROP\",\n \"DELETE\",\n \"INSERT\",\n \"UPDATE\",\n \"SLEEP\",\n \"LOAD_FILE\",\n ]\n for keyword in required_keywords:\n assert keyword in Config.BLOCKED_KEYWORDS\n\n def test_max_query_length(self):\n \"\"\"Test: MAX_QUERY_LENGTH = 2000\"\"\"\n assert Config.MAX_QUERY_LENGTH == 2000\n\n def test_max_rows(self):\n \"\"\"Test: MAX_ROWS = 100\"\"\"\n assert Config.MAX_ROWS == 100\n\n def test_allowed_tables(self):\n \"\"\"Test: ALLOWED_TABLES enthält wichtige Tabellen\"\"\"\n required_tables = [\"mcp_log\", \"chunks\", \"protokoll\"]\n for table in required_tables:\n assert table in Config.ALLOWED_TABLES\n\n\nif __name__ == \"__main__\":\n pytest.main([__file__, \"-v\"])\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/mcp-servers\/mcp-db\/tests\/test_config.py",
"content": "#!\/usr\/bin\/env python3\n\"\"\"Tests für Konfiguration\"\"\"\n\nimport sys\nfrom pathlib import Path\n\nimport pytest\n\nsys.path.insert(0, \"\/opt\/mcp-servers\/mcp-db\")\n\nfrom dotenv import load_dotenv\n\nload_dotenv(Path(\"\/opt\/mcp-servers\/mcp-db\/.env\"))\n\nfrom config import Config\n\n\nclass TestConfig:\n \"\"\"Test Konfiguration\"\"\"\n\n def test_allowed_databases(self):\n \"\"\"Test: ALLOWED_DATABASES korrekt\"\"\"\n assert \"ki_protokoll\" in Config.ALLOWED_DATABASES\n assert \"ki_system\" in Config.ALLOWED_DATABASES\n assert \"mysql\" not in Config.ALLOWED_DATABASES\n\n def test_blocked_keywords(self):\n \"\"\"Test: BLOCKED_KEYWORDS enthält kritische Keywords\"\"\"\n required_keywords = [\n \"DROP\",\n \"DELETE\",\n \"INSERT\",\n \"UPDATE\",\n \"SLEEP\",\n \"LOAD_FILE\",\n ]\n for keyword in required_keywords:\n assert keyword in Config.BLOCKED_KEYWORDS\n\n def test_max_query_length(self):\n \"\"\"Test: MAX_QUERY_LENGTH = 2000\"\"\"\n assert Config.MAX_QUERY_LENGTH == 2000\n\n def test_max_rows(self):\n \"\"\"Test: MAX_ROWS = 100\"\"\"\n assert Config.MAX_ROWS == 100\n\n def test_allowed_tables(self):\n \"\"\"Test: ALLOWED_TABLES enthält wichtige Tabellen\"\"\"\n required_tables = [\"mcp_log\", \"chunks\", \"protokoll\"]\n for table in required_tables:\n assert table in Config.ALLOWED_TABLES\n\n\nif __name__ == \"__main__\":\n pytest.main([__file__, \"-v\"])\n",
"structuredPatch": [],
"originalFile": null
}
}