mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-31 19:37:24 +08:00
Replaces #13744 with a narrower change. Decision after review: drop the dedicated PUT/DELETE /api/assets/{id}/preview endpoints in favor of extending the existing PUT /api/assets/{id} route with a clear_preview_id flag, matching the codebase's existing pattern for clearing operations elsewhere in the project (`clear: true` on /api/queue and /api/history in the cloud sibling). Changes: - openapi.yaml: add `clear_preview_id: boolean` to the UpdateAsset request body, documented as taking precedence over `preview_id` when both are set. - schemas_in.UpdateAssetBody: add the field, extend at-least-one-field validation (clear=true counts, clear=false is a no-op), reject the zero UUID as `preview_id`. - services/asset_management.update_asset_metadata: add `clear_preview_id` param; when true, call set_reference_preview with None to clear the link. Clear takes precedence over set when both provided. - routes.update_asset_route: wire the flag through. Reject self-referential preview_id (preview_id == path id) at 400 SELF_REFERENCE before service call. - Tests: cover clear-via-flag happy path, clear-takes-precedence, schema validation edge cases (zero UUID rejected, clear-only valid, false-only rejected). |
||
|---|---|---|
| .. | ||
| app_test | ||
| assets_test | ||
| comfy_api_test | ||
| comfy_extras_test | ||
| comfy_quant | ||
| comfy_test | ||
| execution_test | ||
| folder_paths_test | ||
| prompt_server_test | ||
| seeder_test | ||
| server/utils | ||
| server_test | ||
| utils | ||
| deploy_environment_test.py | ||
| feature_flags_test.py | ||
| README.md | ||
| requirements.txt | ||
| websocket_feature_flags_test.py | ||
Pytest Unit Tests
Install test dependencies
pip install -r tests-unit/requirements.txt
Run tests
pytest tests-unit/