PAS raises UnauthorizedError when 401 received with no coordination factory configured 🟩

This commit is contained in:
Daniel Roth 2026-05-18 09:12:19 +00:00
parent 0c1ecabf2f
commit 5a29866245

View file

@ -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