- Implemented caching for tool availability and versions. - Added functions to check for ExifTool and FFprobe availability. - Included version satisfaction checks against minimum required versions. - Created utility functions for parsing boolean and float values from environment variables. - Introduced shared utilities for error message sanitization and logging with emoji indicators. - Established a Result pattern for error handling without exceptions. - Added scan throttling helpers to manage background scans efficiently. - Implemented time utilities for timestamps and performance measurement. - Defined shared types, enums, and constants for consistent error handling and file classification. - Created version management utilities to retrieve version information from pyproject.toml. - Developed installation script for runtime dependencies. - Added tests for ExifTool batch processing and various configuration scenarios. - Implemented tests for version route aliases and runtime output root configuration.
15 lines
524 B
Python
15 lines
524 B
Python
from mjr_am_backend.shared import sanitize_error_message
|
|
|
|
|
|
def test_sanitize_error_message_masks_paths() -> None:
|
|
msg = sanitize_error_message(RuntimeError("Failed at C:\\\\secret\\\\file.png"), "Generic error")
|
|
assert "[path]" in msg
|
|
assert "C:\\\\" not in msg
|
|
assert msg.startswith("Generic error:")
|
|
|
|
|
|
def test_sanitize_error_message_returns_fallback_for_empty() -> None:
|
|
assert sanitize_error_message("", "Fallback") == "Fallback"
|
|
assert sanitize_error_message(None, "Fallback") == "Fallback"
|
|
|