Normalizza percorsi e volumi USN
This commit is contained in:
@@ -21,3 +21,17 @@ 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")
|
||||
|
||||
@@ -11,7 +11,9 @@ from bakrest.usn_journal import (
|
||||
USN_REASON_RENAME_NEW_NAME,
|
||||
is_meaningful_usn_reason,
|
||||
parse_usn_records,
|
||||
volume_name_for_path,
|
||||
)
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_usn_reason_filter_accepts_real_data_changes() -> None:
|
||||
@@ -50,3 +52,8 @@ def test_parse_usn_record_v3_reason_and_file_reference() -> None:
|
||||
assert len(records) == 1
|
||||
assert records[0].file_reference_number == 12345
|
||||
assert records[0].reason == USN_REASON_FILE_CREATE
|
||||
|
||||
|
||||
def test_volume_name_is_normalized_to_uppercase_drive() -> None:
|
||||
assert volume_name_for_path(Path("c:/tmp")) == "\\\\.\\C:"
|
||||
assert volume_name_for_path(Path("C:/tmp")) == "\\\\.\\C:"
|
||||
|
||||
Reference in New Issue
Block a user