Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

test(ingest): stub request_with_ssrf_guard in the sitemap and feed error tests (#1986)

Tymur880c7b3c1ccd
diff --git a/tests/ingest/test_feed_ingestor.py b/tests/ingest/test_feed_ingestor.py
index 70e676ed..6dea96e8 100644
--- a/tests/ingest/test_feed_ingestor.py
+++ b/tests/ingest/test_feed_ingestor.py
@@ -85,15 +85,13 @@ def test_ingest_feed_errors() -> None:
ingestor.ingest_feed("not_a_url")
with patch(
- "semantica.ingest.ssrf.socket.getaddrinfo",
- return_value=[(2, 1, 6, "", ("93.184.216.34", 0))],
- ):
- with patch(
- "requests.request",
- side_effect=requests.exceptions.RequestException("Fail"),
- ):
- with pytest.raises(ProcessingError):
- ingestor.ingest_feed("http://valid.com")
+ "semantica.ingest.feed_ingestor.request_with_ssrf_guard",
+ side_effect=requests.exceptions.RequestException("Fail"),
+ ) as mock_request:
+ with pytest.raises(ProcessingError):
+ ingestor.ingest_feed("http://valid.com")
+
+ mock_request.assert_called_once()
def test_monitor_loop_lifecycle() -> None:
diff --git a/tests/ingest/test_web_ingestor.py b/tests/ingest/test_web_ingestor.py
index f63b0af9..890159ff 100644
--- a/tests/ingest/test_web_ingestor.py
+++ b/tests/ingest/test_web_ingestor.py
@@ -79,12 +79,14 @@ def test_sitemap_invalid_xml() -> None:
crawler = SitemapCrawler()
with patch(
- "requests.get",
+ "semantica.ingest.web_ingestor.request_with_ssrf_guard",
return_value=MagicMock(status_code=200, content=b"NOT XML"),
- ):
+ ) as mock_request:
with pytest.raises(ProcessingError):
crawler.parse_sitemap("http://s.xml")
+ mock_request.assert_called_once()
+
# --- Content Extraction Tests ---
def test_extract_links_schemes() -> None: