Aggiunge GUI di configurazione

This commit is contained in:
2026-07-01 08:59:06 +02:00
parent 8f624f5b97
commit 118f01f81a
8 changed files with 418 additions and 2 deletions

14
tests/test_config_save.py Normal file
View File

@@ -0,0 +1,14 @@
from __future__ import annotations
from pathlib import Path
from bakrest.config import load_config_data, save_config_data
def test_save_config_data_round_trips(tmp_path: Path) -> None:
path = tmp_path / "config.toml"
data = {"watch": {"include_dirs": [str(tmp_path)], "include_extensions": [".jpg"]}}
save_config_data(data, path)
assert load_config_data(path) == data

26
tests/test_registry.py Normal file
View File

@@ -0,0 +1,26 @@
from __future__ import annotations
from pathlib import Path
from bakrest.registry import ChangeEvent, ChangeRegistry
def test_pending_changes_persist_until_marked(tmp_path: Path) -> None:
db_path = tmp_path / "changes.sqlite"
first = ChangeRegistry(db_path)
first.record(ChangeEvent(path=str(tmp_path / "image.jpg"), event_type="modified"))
second = ChangeRegistry(db_path)
assert second.pending_count() == 1
def test_mark_ignored_removes_from_pending_queue(tmp_path: Path) -> None:
db_path = tmp_path / "changes.sqlite"
registry = ChangeRegistry(db_path)
path = str(tmp_path / "image.jpg")
registry.record(ChangeEvent(path=path, event_type="modified"))
registry.mark_ignored(path)
assert registry.pending_count() == 0