fix: correct mock paths
This commit is contained in:
parent
77732d8698
commit
0df22fe703
3 changed files with 7 additions and 8 deletions
|
|
@ -40,11 +40,10 @@ Be careful with deletion operations as they are irreversible.
|
||||||
# Validate arguments
|
# Validate arguments
|
||||||
if not any(
|
if not any(
|
||||||
[
|
[
|
||||||
hasattr(args, "dataset_name"),
|
getattr(args, "dataset_name", None),
|
||||||
hasattr(args, "dataset_id"),
|
getattr(args, "dataset_id", None),
|
||||||
hasattr(args, "data_id"),
|
getattr(args, "data_id", None),
|
||||||
hasattr(args, "user_id"),
|
getattr(args, "all", False) and getattr(args, "user_id", None),
|
||||||
hasattr(args, "all"),
|
|
||||||
]
|
]
|
||||||
):
|
):
|
||||||
fmt.error(
|
fmt.error(
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ class TestDeleteCommand:
|
||||||
assert "all" in actions
|
assert "all" in actions
|
||||||
assert "force" 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.modules.data.methods.get_deletion_counts.get_user")
|
||||||
@patch("cognee.cli.commands.delete_command.fmt.confirm")
|
@patch("cognee.cli.commands.delete_command.fmt.confirm")
|
||||||
@patch("cognee.cli.commands.delete_command.asyncio.run", side_effect=_mock_run)
|
@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}'?")
|
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)
|
@patch("cognee.cli.commands.delete_command.asyncio.run", side_effect=_mock_run)
|
||||||
def test_execute_delete_forced(self, mock_asyncio_run, delete_all_mock):
|
def test_execute_delete_forced(self, mock_asyncio_run, delete_all_mock):
|
||||||
"""Test execute delete with force flag"""
|
"""Test execute delete with force flag"""
|
||||||
|
|
|
||||||
|
|
@ -382,7 +382,7 @@ class TestDeleteCommandEdgeCases:
|
||||||
|
|
||||||
@patch("cognee.cli.commands.delete_command.asyncio.run", side_effect=_mock_run)
|
@patch("cognee.cli.commands.delete_command.asyncio.run", side_effect=_mock_run)
|
||||||
@patch("cognee.cli.commands.delete_command.fmt.confirm")
|
@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):
|
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"""
|
"""Test delete command with both --all and --user-id"""
|
||||||
fmt_confirm_mock.return_value = True
|
fmt_confirm_mock.return_value = True
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue