diff --git a/cognee/cli/commands/delete_command.py b/cognee/cli/commands/delete_command.py index d23c362b4..9fc00fd92 100644 --- a/cognee/cli/commands/delete_command.py +++ b/cognee/cli/commands/delete_command.py @@ -40,11 +40,10 @@ Be careful with deletion operations as they are irreversible. # Validate arguments if not any( [ - hasattr(args, "dataset_name"), - hasattr(args, "dataset_id"), - hasattr(args, "data_id"), - hasattr(args, "user_id"), - hasattr(args, "all"), + getattr(args, "dataset_name", None), + getattr(args, "dataset_id", None), + getattr(args, "data_id", None), + getattr(args, "all", False) and getattr(args, "user_id", None), ] ): fmt.error( diff --git a/cognee/tests/cli_tests/cli_unit_tests/test_cli_commands.py b/cognee/tests/cli_tests/cli_unit_tests/test_cli_commands.py index 3f825a64c..9a6f03c91 100644 --- a/cognee/tests/cli_tests/cli_unit_tests/test_cli_commands.py +++ b/cognee/tests/cli_tests/cli_unit_tests/test_cli_commands.py @@ -285,7 +285,7 @@ class TestDeleteCommand: assert "all" in actions assert "force" in actions - @patch("cognee.api.v1.datasets.datasets.delete_dataset") + @patch("cognee.datasets.delete_dataset") @patch("cognee.modules.data.methods.get_deletion_counts.get_user") @patch("cognee.cli.commands.delete_command.fmt.confirm") @patch("cognee.cli.commands.delete_command.asyncio.run", side_effect=_mock_run) @@ -325,7 +325,7 @@ class TestDeleteCommand: mock_confirm.assert_called_once_with(f"Delete dataset '{args.dataset_name}'?") - @patch("cognee.api.v1.datasets.datasets.delete_all") + @patch("cognee.datasets.delete_all") @patch("cognee.cli.commands.delete_command.asyncio.run", side_effect=_mock_run) def test_execute_delete_forced(self, mock_asyncio_run, delete_all_mock): """Test execute delete with force flag""" diff --git a/cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py b/cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py index 344c61ed0..178c6aa7f 100644 --- a/cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py +++ b/cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py @@ -382,7 +382,7 @@ class TestDeleteCommandEdgeCases: @patch("cognee.cli.commands.delete_command.asyncio.run", side_effect=_mock_run) @patch("cognee.cli.commands.delete_command.fmt.confirm") - @patch("cognee.api.v1.datasets.datasets.delete_all") + @patch("cognee.datasets.delete_all") def test_delete_all_with_user_id(self, delete_all_mock, fmt_confirm_mock, async_run_mock): """Test delete command with both --all and --user-id""" fmt_confirm_mock.return_value = True