"""Tests for Torznab XML parsing helpers."""
from shelfmark.release_sources.prowlarr.torznab import parse_torznab_xml
def test_parse_torznab_xml_parses_basic_item():
xml_text = """
-
Example Release
abc-123
https://example.com/download
12345
Test Indexer
"""
results = parse_torznab_xml(xml_text)
assert len(results) == 1
result = results[0]
assert result["title"] == "Example Release"
assert result["guid"] == "abc-123"
assert result["indexerId"] == 42
assert result["indexer"] == "Test Indexer"
assert result["protocol"] == "torrent"
assert result["seeders"] == 10
assert result["leechers"] == 5
def test_parse_torznab_xml_rejects_entity_expansion_payload():
xml_text = """
]>
-
&xxe;
"""
assert parse_torznab_xml(xml_text) == []