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
|
||||
from contextlib import asynccontextmanager
|
||||
from cognee.shared.logging_utils import setup_logging
|
||||
from logging import ERROR, INFO
|
||||
|
||||
from mcp import ClientSession, StdioServerParameters
|
||||
from mcp.client.stdio import stdio_client
|
||||
|
|
@ -407,9 +408,9 @@ DEBUG = True
|
|||
raise Exception("Delete returned no content")
|
||||
|
||||
else:
|
||||
logger = setup_logging(log_level=INFO)
|
||||
# Test with invalid UUIDs to check error handling
|
||||
try:
|
||||
await session.call_tool(
|
||||
invalid_result = await session.call_tool(
|
||||
"delete",
|
||||
arguments={
|
||||
"data_id": "invalid-uuid",
|
||||
|
|
@ -417,17 +418,22 @@ DEBUG = True
|
|||
"mode": "soft",
|
||||
},
|
||||
)
|
||||
except Exception as e:
|
||||
assert ("Invalid UUID format" in e)
|
||||
|
||||
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": e,
|
||||
"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:
|
||||
raise Exception("Delete error test returned no content")
|
||||
logger = setup_logging(log_level=ERROR)
|
||||
|
||||
except Exception as e:
|
||||
self.test_results["delete"] = {
|
||||
|
|
@ -630,7 +636,5 @@ async def main():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from logging import ERROR
|
||||
|
||||
logger = setup_logging(log_level=ERROR)
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue