Add file URL RSS feed coverage
This commit is contained in:
parent
20b9759193
commit
fc102d9445
3 changed files with 69 additions and 0 deletions
36
tests/test_file_feeds.py
Normal file
36
tests/test_file_feeds.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
from pathlib import Path
|
||||
|
||||
from repub import entrypoint as entrypoint_module
|
||||
|
||||
|
||||
def test_entrypoint_supports_file_feed_urls(tmp_path: Path, monkeypatch) -> None:
|
||||
fixture_path = (
|
||||
Path(__file__).resolve().parents[1] / "demo" / "fixtures" / "local-feed.rss"
|
||||
).resolve()
|
||||
config_path = tmp_path / "repub.toml"
|
||||
config_path.write_text(
|
||||
f"""
|
||||
out_dir = "out"
|
||||
|
||||
[[feeds]]
|
||||
name = "local-file"
|
||||
url = "{fixture_path.as_uri()}"
|
||||
|
||||
[scrapy.settings]
|
||||
LOG_LEVEL = "ERROR"
|
||||
DOWNLOAD_TIMEOUT = 5
|
||||
""".strip()
|
||||
+ "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
monkeypatch.setattr(entrypoint_module, "check_runtime", lambda *_: True)
|
||||
|
||||
exit_code = entrypoint_module.entrypoint(["--config", str(config_path)])
|
||||
|
||||
output_path = tmp_path / "out" / "local-file.rss"
|
||||
assert exit_code == 0
|
||||
assert output_path.exists()
|
||||
output = output_path.read_text(encoding="utf-8")
|
||||
assert "<title>Local Demo Feed</title>" in output
|
||||
assert "<title>Local Demo Entry</title>" in output
|
||||
Loading…
Add table
Add a link
Reference in a new issue