27 lines
773 B
Python
27 lines
773 B
Python
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
|