Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Daulet Amirkhanov
96ab005d4e fix 2025-10-02 17:35:57 +01:00
Daulet Amirkhanov
a607d8f213 temp commit 2025-10-02 17:18:39 +01:00
2 changed files with 11 additions and 1 deletions

View file

@ -8,6 +8,10 @@ import cognee.cli.echo as fmt
from cognee.cli.exceptions import CliCommandException, CliCommandInnerException
from cognee.modules.data.methods.get_deletion_counts import get_deletion_counts
from cognee.shared.logging_utils import get_logger
logger = get_logger()
class DeleteCommand(SupportsCliCommand):
command_string = "delete"
@ -109,4 +113,5 @@ Be careful with deletion operations as they are irreversible.
except Exception as e:
if isinstance(e, CliCommandInnerException):
raise CliCommandException(str(e), error_code=1)
logger.error(f"{str(e)}", exc_info=True)
raise CliCommandException(f"Error deleting data: {str(e)}", error_code=1)

View file

@ -379,10 +379,15 @@ class TestCognifyCommandEdgeCases:
class TestDeleteCommandEdgeCases:
"""Test edge cases for DeleteCommand"""
@patch("cognee.cli.commands.delete_command.get_deletion_counts")
@patch("cognee.cli.commands.delete_command.fmt.confirm")
@patch("cognee.cli.commands.delete_command.asyncio.run", side_effect=_mock_run)
def test_delete_all_with_user_id(self, mock_asyncio_run, mock_confirm):
def test_delete_all_with_user_id(
self, mock_asyncio_run, mock_confirm, mock_get_deletion_counts
):
"""Test delete command with both --all and --user-id"""
mock_get_deletion_counts.return_value = DeletionCountsPreview()
# Mock the cognee module
mock_cognee = MagicMock()
mock_cognee.delete = AsyncMock()