Let the runner drop and count a row without an id, a title or a link, as ADR Plugins 3.8 has it, in one place for whole, paged and search reads: the count is stamped per target, logged, named on the board's row, and over 10% of the rows fails the read; the 28 readers hand every listing over instead of skipping it
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
38c31c830b
commit
911dfe8584
58 files changed
+479
-203
No files matched your search
@@ -16,7 +16,7 @@ if str(ROOT) not in sys.path:
|
||||
|
||||
from app.jobs.discover import boards_in # noqa: E402
|
||||
from plugins import ats, readers # noqa: E402
|
||||
from plugins.readers import Ask, hrmanager # noqa: E402
|
||||
from plugins.readers import Ask, _runner, hrmanager # noqa: E402
|
||||
|
||||
FIXTURES = ROOT / "tests" / "fixtures" / "ats"
|
||||
BOARD = (FIXTURES / "hrmanager.xml").read_bytes()
|
||||
@@ -52,12 +52,14 @@ def test_a_channel_with_no_items_is_an_empty_board_and_another_answer_is_not_a_f
|
||||
hrmanager.parse(b"<html><body>404 - File or directory not found.</body></html>", "x")
|
||||
|
||||
|
||||
def test_an_item_without_a_title_or_a_web_link_is_skipped() -> None:
|
||||
def test_an_item_without_a_title_or_a_web_link_is_handed_over_for_the_runner_to_drop() -> None:
|
||||
body = (b"<rss><channel><item><guid>1</guid><title> </title><link>https://a.example/1</link></item>"
|
||||
b"<item><guid>2</guid><title>B</title><link>javascript:alert(1)</link></item>"
|
||||
b"<item><guid>3</guid><title>C</title><link>https://a.example/3</link></item>"
|
||||
b"</channel></rss>")
|
||||
assert [r["source_id"] for r in hrmanager.parse(body, "x")] == ["3"]
|
||||
rows = hrmanager.parse(body, "x")
|
||||
assert [r["source_id"] for r in rows] == ["1", "2", "3"]
|
||||
assert [r["source_id"] for r in rows if _runner.valid(r)] == ["3"]
|
||||
|
||||
|
||||
# ------------------------------------------------------------- paging
|
||||
|
||||
Reference in new issue
Block a user