Supporta utente target per percorsi watchdog

This commit is contained in:
2026-07-02 09:22:12 +02:00
parent b0e29b4cc5
commit e5a76992d4
9 changed files with 130 additions and 11 deletions

View File

@@ -22,6 +22,25 @@ def test_parse_config_normalizes_extensions(tmp_path: Path) -> None:
assert config.watch.include_extensions == frozenset({".jpg", ".png"})
def test_parse_config_expands_watch_paths_for_target_user(tmp_path: Path) -> None:
config = parse_config(
{
"watch": {
"target_user": "pettirosso",
"include_dirs": ["%USERPROFILE%\\Documents"],
"include_extensions": [".docx"],
"exclude_dirs": ["%APPDATA%"],
"exclude_patterns": [],
}
},
tmp_path / "config.toml",
)
assert config.watch.target_user == "pettirosso"
assert config.watch.include_dirs == (Path("C:/Users/pettirosso/Documents"),)
assert config.watch.exclude_dirs == (Path("C:/Users/pettirosso/AppData/Roaming"),)
def test_parse_config_reads_multiple_remote_destinations(tmp_path: Path) -> None:
config = parse_config(
{

23
tests/test_paths.py Normal file
View File

@@ -0,0 +1,23 @@
from __future__ import annotations
from pathlib import Path
from bakrest.paths import expand_path
def test_expand_path_uses_target_user_for_userprofile() -> None:
assert expand_path("%USERPROFILE%\\Documents", "pettirosso") == Path(
"C:/Users/pettirosso/Documents"
)
def test_expand_path_uses_target_user_for_appdata() -> None:
assert expand_path("%APPDATA%\\Microsoft", ".\\pettirosso") == Path(
"C:/Users/pettirosso/AppData/Roaming/Microsoft"
)
def test_expand_path_uses_target_user_for_temp() -> None:
assert expand_path("%TEMP%", "pettirosso") == Path(
"C:/Users/pettirosso/AppData/Local/Temp"
)