diff --git a/backend/pashub_fetcher/tests/test_pashub_service.py b/backend/pashub_fetcher/tests/test_pashub_service.py index 6cf889a2..df77287d 100644 --- a/backend/pashub_fetcher/tests/test_pashub_service.py +++ b/backend/pashub_fetcher/tests/test_pashub_service.py @@ -73,6 +73,30 @@ def test_run_returns_file_paths() -> None: assert result == ["/tmp/a.pdf", "/tmp/b.pdf"] +# --------------------------------------------------------------------------- +# run(): returns core + other file paths when get_other_files=True +# --------------------------------------------------------------------------- + + +def test_run_returns_core_and_other_file_paths() -> None: + # Arrange + mock_client = MagicMock(spec=PashubClient) + mock_client.get_uprn_by_job_id.return_value = None + mock_client.get_evidence_files_by_job_id.return_value = make_downloaded( + core=["/tmp/core.pdf"], + other=["/tmp/other.pdf"], + ) + + service = make_service(pashub_client=mock_client) + + # Act + with patch("backend.pashub_fetcher.pashub_service.os.remove"): + result = service.run(make_request(get_other_files=True)) + + # Assert + assert result == ["/tmp/core.pdf", "/tmp/other.pdf"] + + # --------------------------------------------------------------------------- # run(): skips upload when neither uprn nor hubspot_deal_id # ---------------------------------------------------------------------------