Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/voxkit/storage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,12 @@ def delete_model(engine_id: str, model_id: str) -> Tuple[bool, str]:
Notes:
- This operation is irreversible
- Removes the entire model directory tree
- Validates that engine_id and model_id are not empty before proceeding
"""

if not engine_id or not model_id:
return False, "Engine ID and Model ID cannot be empty."

print(f"Attempting to delete model: engine_id={engine_id}, model_id={model_id}")
model_path = _get_model_root(engine_id, model_id)

Expand Down
23 changes: 23 additions & 0 deletions tests/storage/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,29 @@ def test_delete_model_invalid_engine(self, monkeypatch):
assert success is False
assert "not found" in msg

def test_delete_model_empty_ids(self, monkeypatch):
from voxkit.storage import models
from voxkit.storage.models import delete_model

monkeypatch.setattr(models, "get_storage_root", mock_get_storage_root)

engine_id = ENGINE_IDS[0]

# Empty model_id
success, msg = delete_model(engine_id=engine_id, model_id="")
assert success is False
assert "cannot be empty" in msg

# Empty engine_id
success, msg = delete_model(engine_id="", model_id="some_model_id")
assert success is False
assert "cannot be empty" in msg

# Both empty
success, msg = delete_model(engine_id="", model_id="")
assert success is False
assert "cannot be empty" in msg

class TestGetModelMetadata:
def test_get_model_metadata_success(self, monkeypatch):
from voxkit.storage import models
Expand Down
Loading