mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Service deletes other-file temp paths after run 🟥
This commit is contained in:
parent
49e7b7fea6
commit
f8d2bb8049
1 changed files with 25 additions and 0 deletions
|
|
@ -377,6 +377,31 @@ def test_run_persists_coordination_hub_file_source_when_pas_401_on_file_listing(
|
|||
assert added[0].file_source == FileSourceEnum.COORDINATION_HUB.value
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# run(): get_other_files=True → other temp files deleted after run
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_run_deletes_other_temp_files_when_get_other_files_true() -> 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") as mock_remove:
|
||||
service.run(make_request(get_other_files=True))
|
||||
|
||||
# Assert
|
||||
mock_remove.assert_any_call("/tmp/core.pdf")
|
||||
mock_remove.assert_any_call("/tmp/other.pdf")
|
||||
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue