CadHubManage/tests/test_cad_task_router.py
sladro b19ef1467a feat: Implement CAD batch processing framework with plugin callback handling
- Added configuration for file storage and software plugins in `software_config.yaml`.
- Created core components for batch processing including `CadBatchManager`, `CadTaskRouter`, and `SerialBatchExecutor`.
- Implemented plugin callback handling with `PluginCallbackRegistry` and HTTP client for task submission.
- Developed API endpoint for receiving plugin callbacks in `plugin_callbacks.py`.
- Enhanced data models for batch processing including `BatchJob`, `BatchItem`, and callback payloads.
- Introduced WebSocket support for real-time updates on batch processing status.
- Added comprehensive tests for routing, callback API, and serial executor behavior.
- Documented the implementation plan and core execution rules in `cad-batch-plan.md`.
2026-03-01 08:48:10 +08:00

29 lines
743 B
Python

import pytest
from app.core.cad_task_router import CadTaskRouter, RouteNotFoundError
def test_router_resolves_standard_extension():
router = CadTaskRouter({".prt": "creo", ".rvt": "revit"})
ext, software_id = router.resolve("models/part_a.prt")
assert ext == ".prt"
assert software_id == "creo"
def test_router_resolves_versioned_extension():
router = CadTaskRouter({".prt": "creo", ".asm": "creo"})
ext, software_id = router.resolve("D:/cad/sample/assembly.asm.3")
assert ext == ".asm"
assert software_id == "creo"
def test_router_unknown_extension_raises():
router = CadTaskRouter({".rvt": "revit"})
with pytest.raises(RouteNotFoundError):
router.resolve("models/unknown.step")