fix: use __wrapped__ without self for Celery bind=True tasks in error tests
Celery's __wrapped__ attribute strips the self parameter for bind=True tasks. Updated error-case tests to call __wrapped__(file_path, ...) instead of __wrapped__(mock_self, file_path, ...) to avoid 'multiple values' TypeError. Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -20,11 +20,8 @@ class TestUploadToNextcloud:
|
||||
"""Test that missing file raises FileNotFoundError."""
|
||||
from app.tasks.upload_to_nextcloud import upload_to_nextcloud
|
||||
|
||||
mock_self = MagicMock()
|
||||
mock_self.request.id = "test-task"
|
||||
|
||||
with pytest.raises(FileNotFoundError):
|
||||
upload_to_nextcloud.__wrapped__(mock_self, "/nonexistent/file.pdf", file_id=1)
|
||||
upload_to_nextcloud.__wrapped__("/nonexistent/file.pdf", file_id=1)
|
||||
|
||||
@patch("app.tasks.upload_to_nextcloud.log_task_progress")
|
||||
@patch("app.tasks.upload_to_nextcloud.settings")
|
||||
|
||||
Reference in New Issue
Block a user