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