Add more tests
Some checks failed
Test and build Docker image / docker (push) Failing after 1s

This commit is contained in:
Joakim Hellsén 2026-05-31 01:18:28 +02:00
commit a22601a854
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
4 changed files with 234 additions and 4 deletions

View file

@ -2,7 +2,9 @@ from __future__ import annotations
import tempfile
from pathlib import Path
from types import SimpleNamespace
from typing import TYPE_CHECKING
from typing import cast
from reader import Entry
from reader import Feed
@ -12,6 +14,7 @@ from reader import make_reader
from discord_rss_bot.filter.blacklist import entry_should_be_skipped
from discord_rss_bot.filter.blacklist import feed_has_blacklist_tags
from discord_rss_bot.filter.evaluator import evaluate_entry_filters
from discord_rss_bot.filter.evaluator import get_entry_fields
from discord_rss_bot.filter.evaluator import get_filter_values_from_reader
if TYPE_CHECKING:
@ -67,6 +70,23 @@ def check_if_has_tag(reader: Reader, feed: Feed, blacklist_name: str) -> None:
assert feed_has_blacklist_tags(reader=reader, feed=feed) is False, asset_msg
def test_get_entry_fields_uses_authors_str() -> None:
entry = cast(
"Entry",
SimpleNamespace(
title="Title",
summary="Summary",
content=[],
author="Legacy Author",
authors_str="Author One, Author Two",
),
)
fields: dict[str, str] = get_entry_fields(entry)
assert fields["author"] == "Author One, Author Two"
def test_should_be_skipped() -> None:
reader: Reader = get_reader()