mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
SharePoint upload is skipped when client is None 🟥
This commit is contained in:
parent
761962e991
commit
8ccee0ea77
1 changed files with 27 additions and 0 deletions
|
|
@ -616,6 +616,33 @@ def test_sharepoint_skips_upload_when_folder_not_found() -> None:
|
|||
mock_logger.warning.assert_called()
|
||||
|
||||
|
||||
def test_sharepoint_skips_upload_when_sharepoint_client_is_none() -> 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"]
|
||||
)
|
||||
|
||||
service = PashubService(
|
||||
pashub_client=mock_client,
|
||||
sharepoint_client=None,
|
||||
s3_bucket="test-bucket",
|
||||
)
|
||||
|
||||
# Act — should not raise AttributeError on None._sharepoint_client
|
||||
with patch("backend.pashub_fetcher.pashub_service.os.remove"):
|
||||
result = service.run(
|
||||
make_request(
|
||||
sharepoint_link="Retrofit/Properties",
|
||||
address="123 Main St | deal",
|
||||
)
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert result == ["/tmp/core.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