fix: return boolean values from _should_upload functions and fix test expectations

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-16 16:59:17 +00:00
parent 6b4b0deefb
commit f2eff3e2fb
3 changed files with 20 additions and 15 deletions
+8 -3
View File
@@ -182,10 +182,15 @@ class TestGetConfiguredServicesFromValidator:
class TestSendToAllDestinations:
"""Test send_to_all_destinations task."""
def test_file_not_found_error(self):
@patch("app.tasks.send_to_all.log_task_progress")
def test_file_not_found_error(self, mock_log):
"""Test that FileNotFoundError is raised when file doesn't exist."""
with pytest.raises(FileNotFoundError):
send_to_all_destinations.apply(args=["/nonexistent/file.pdf"])
result = send_to_all_destinations.apply(args=["/nonexistent/file.pdf"])
# When task raises an exception, result.failed() returns True
assert result.failed()
# The exception should be FileNotFoundError
assert isinstance(result.result, FileNotFoundError)
@patch("app.tasks.send_to_all.settings")
@patch("app.tasks.send_to_all._should_upload_to_dropbox")