From dcff529219103ed2bfb0faf5a58e0be814683d8d Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 18 May 2026 09:13:51 +0000 Subject: [PATCH] =?UTF-8?q?UnauthorizedError=20propagates=20when=20both=20?= =?UTF-8?q?PAS=20and=20coordination=20clients=20return=20401=20?= =?UTF-8?q?=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pashub_fetcher/tests/test_pashub_service.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend/pashub_fetcher/tests/test_pashub_service.py b/backend/pashub_fetcher/tests/test_pashub_service.py index ff4a8977..991d2a46 100644 --- a/backend/pashub_fetcher/tests/test_pashub_service.py +++ b/backend/pashub_fetcher/tests/test_pashub_service.py @@ -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