38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
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"
|
|
)
|
|
|
|
|
|
def test_expand_path_normalizes_drive_root() -> None:
|
|
assert expand_path("d:") == Path("D:/")
|
|
|
|
|
|
def test_expand_path_maps_downloads_token_for_target_user() -> None:
|
|
assert expand_path("%DOWNLOADS%", "utente") == Path("C:/Users/utente/Downloads")
|
|
|
|
|
|
def test_expand_path_maps_italian_known_folder_aliases() -> None:
|
|
assert expand_path("%USERPROFILE%\\Immagini", "utente") == Path("C:/Users/utente/Pictures")
|
|
assert expand_path("%USERPROFILE%\\Musica", "utente") == Path("C:/Users/utente/Music")
|
|
assert expand_path("%USERPROFILE%\\video", "utente") == Path("C:/Users/utente/Videos")
|