line-today-scrape/tests/test_registry.py
Sosokker 04b39ed883
Some checks failed
CI / test (push) Has been cancelled
scrape articles concurrently and add articles registry
2025-10-29 16:42:07 +07:00

21 lines
564 B
Python

import asyncio
from pathlib import Path
from linetoday.registry import ArticleRegistry
def test_registry_persist_roundtrip(tmp_path: Path):
registry_path = tmp_path / 'processed.txt'
url = 'https://today.line.me/th/v3/article/test123'
registry = ArticleRegistry(path=registry_path)
assert not registry.contains(url)
asyncio.run(registry.mark(url))
assert registry.contains(url)
# Reload and ensure persistence
registry2 = ArticleRegistry(path=registry_path)
assert registry2.contains(url)
assert registry2.size() == 1