UnauthorizedError propagates when both PAS and coordination clients return 401 🟩

This commit is contained in:
Daniel Roth 2026-05-18 09:13:51 +00:00
parent 5a29866245
commit dcff529219

View file

@ -291,6 +291,21 @@ def test_run_raises_unauthorized_when_pas_401_and_no_factory() -> None:
service.run(make_request())
def test_run_raises_unauthorized_when_both_clients_401() -> None:
pas_client = MagicMock(spec=PashubClient)
pas_client.get_uprn_by_job_id.side_effect = UnauthorizedError()
coord_client = MagicMock(spec=PashubClient)
coord_client.get_uprn_by_job_id.side_effect = UnauthorizedError()
factory = MagicMock(return_value=coord_client)
service = make_service(pashub_client=pas_client, coordination_client_factory=factory)
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