From 5a29866245fefae3ac5b4aee6ddba1d09ce7eb1d Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 18 May 2026 09:12:19 +0000 Subject: [PATCH] =?UTF-8?q?PAS=20raises=20UnauthorizedError=20when=20401?= =?UTF-8?q?=20received=20with=20no=20coordination=20factory=20configured?= =?UTF-8?q?=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/pashub_fetcher/tests/test_pashub_service.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/pashub_fetcher/tests/test_pashub_service.py b/backend/pashub_fetcher/tests/test_pashub_service.py index dd8ad0a8..ff4a8977 100644 --- a/backend/pashub_fetcher/tests/test_pashub_service.py +++ b/backend/pashub_fetcher/tests/test_pashub_service.py @@ -1,3 +1,4 @@ +import pytest from typing import Callable, Optional from unittest.mock import MagicMock, call, patch @@ -280,6 +281,16 @@ def test_run_uses_coordination_client_when_pas_401_on_file_listing() -> None: pas_client.get_uprn_by_job_id.assert_not_called() +def test_run_raises_unauthorized_when_pas_401_and_no_factory() -> None: + pas_client = MagicMock(spec=PashubClient) + pas_client.get_uprn_by_job_id.side_effect = UnauthorizedError() + + service = make_service(pashub_client=pas_client) + + with pytest.raises(UnauthorizedError): + service.run(make_request()) + + def test_run_warns_and_continues_when_site_notes_parsing_fails() -> None: mock_client = MagicMock(spec=PashubClient) mock_client.get_uprn_by_job_id.return_value = None