Fix feed validation output
This commit is contained in:
parent
c834c3c254
commit
db1d9b44b7
13 changed files with 477 additions and 54 deletions
37
tests/test_job_runner.py
Normal file
37
tests/test_job_runner.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from repub.config import FeedConfig
|
||||
from repub.job_runner import _build_crawl_settings
|
||||
|
||||
|
||||
def test_build_crawl_settings_passes_feed_url_to_spider(tmp_path: Path) -> None:
|
||||
settings = _build_crawl_settings(
|
||||
out_dir=tmp_path / "out",
|
||||
feed=FeedConfig(
|
||||
name="Demo Feed",
|
||||
slug="demo",
|
||||
url="https://source.example/feed.rss",
|
||||
),
|
||||
stats_path=tmp_path / "stats.jsonl",
|
||||
feed_url="https://mirror.example",
|
||||
)
|
||||
|
||||
assert settings["REPUBLISHER_FEED_URL"] == "https://mirror.example"
|
||||
|
||||
|
||||
def test_build_crawl_settings_requires_non_empty_feed_url(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
with pytest.raises(ValueError, match="feed_url setting is required"):
|
||||
_build_crawl_settings(
|
||||
out_dir=tmp_path / "out",
|
||||
feed=FeedConfig(
|
||||
name="Demo Feed",
|
||||
slug="demo",
|
||||
url="https://source.example/feed.rss",
|
||||
),
|
||||
stats_path=tmp_path / "stats.jsonl",
|
||||
feed_url="",
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue