Skip to content

Commit d5d01c5

Browse files
committed
refactor(registry): Use dependency injection for static file routes
Refactored UI route handlers in main.py (e.g., /ui, /ui/developer) to use FastAPI's dependency injection (Depends) for accessing static file content. Introduced a StaticFileReader class dependency to encapsulate file reading logic. Updated corresponding tests in est_main_routes.py to use �pp.dependency_overrides to inject mock StaticFileReader instances with different behaviors (success, file not found, read error). Removed previous brittle attempts to mock pathlib.Path or �uiltins.open directly. This approach provides a more robust and idiomatic way to test routes interacting with external resources like the filesystem, resolving previous test failures caused by ineffective mocking. fix(registry): Correct error detail assertions in main route tests Adjusted assertions in est_ui_routes_file_not_found and est_ui_routes_read_error to check for the exact, static error detail messages returned by the corresponding route handlers in main.py, instead of incorrectly expecting the filename to be part of the detail string.
1 parent 6d9baf3 commit d5d01c5

File tree

2 files changed

+333
-137
lines changed

2 files changed

+333
-137
lines changed

0 commit comments

Comments
 (0)