test: change logger
This commit is contained in:
parent
c48b274571
commit
bce6094010
1 changed files with 23 additions and 19 deletions
|
|
@ -23,6 +23,7 @@ import tempfile
|
||||||
import time
|
import time
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from cognee.shared.logging_utils import setup_logging
|
from cognee.shared.logging_utils import setup_logging
|
||||||
|
from logging import ERROR, INFO
|
||||||
|
|
||||||
from mcp import ClientSession, StdioServerParameters
|
from mcp import ClientSession, StdioServerParameters
|
||||||
from mcp.client.stdio import stdio_client
|
from mcp.client.stdio import stdio_client
|
||||||
|
|
@ -407,27 +408,32 @@ DEBUG = True
|
||||||
raise Exception("Delete returned no content")
|
raise Exception("Delete returned no content")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
logger = setup_logging(log_level=INFO)
|
||||||
# Test with invalid UUIDs to check error handling
|
# Test with invalid UUIDs to check error handling
|
||||||
try:
|
invalid_result = await session.call_tool(
|
||||||
await session.call_tool(
|
"delete",
|
||||||
"delete",
|
arguments={
|
||||||
arguments={
|
"data_id": "invalid-uuid",
|
||||||
"data_id": "invalid-uuid",
|
"dataset_id": "another-invalid-uuid",
|
||||||
"dataset_id": "another-invalid-uuid",
|
"mode": "soft",
|
||||||
"mode": "soft",
|
},
|
||||||
},
|
)
|
||||||
)
|
|
||||||
except Exception as e:
|
|
||||||
assert ("Invalid UUID format" in e)
|
|
||||||
self.test_results["delete_error_handling"] = {
|
|
||||||
"status": "PASS",
|
|
||||||
"result": e,
|
|
||||||
"message": "delete error handling works correctly",
|
|
||||||
}
|
|
||||||
print("✅ delete error handling test passed")
|
|
||||||
|
|
||||||
|
if invalid_result.content and len(invalid_result.content) > 0:
|
||||||
|
invalid_content = invalid_result.content[0].text
|
||||||
|
|
||||||
|
if "Invalid UUID format" in invalid_content:
|
||||||
|
self.test_results["delete_error_handling"] = {
|
||||||
|
"status": "PASS",
|
||||||
|
"result": invalid_content,
|
||||||
|
"message": "delete error handling works correctly",
|
||||||
|
}
|
||||||
|
print("✅ delete error handling test passed")
|
||||||
|
else:
|
||||||
|
raise Exception(f"Expected UUID error not found: {invalid_content}")
|
||||||
else:
|
else:
|
||||||
raise Exception("Delete error test returned no content")
|
raise Exception("Delete error test returned no content")
|
||||||
|
logger = setup_logging(log_level=ERROR)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.test_results["delete"] = {
|
self.test_results["delete"] = {
|
||||||
|
|
@ -630,7 +636,5 @@ async def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from logging import ERROR
|
|
||||||
|
|
||||||
logger = setup_logging(log_level=ERROR)
|
logger = setup_logging(log_level=ERROR)
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue