style: apply ruff auto-fix
- Auto-formatted code with ruff format - Applied ruff linting fixes with --fix Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -917,15 +917,15 @@ class TestURLUploadCoverageGaps:
|
|||||||
def test_process_url_validate_redirect_hook_blocks_unsafe_url(self, mock_stream, mock_validate, client):
|
def test_process_url_validate_redirect_hook_blocks_unsafe_url(self, mock_stream, mock_validate, client):
|
||||||
"""Test that the local validate_redirect hook successfully aborts the request when redirect is unsafe"""
|
"""Test that the local validate_redirect hook successfully aborts the request when redirect is unsafe"""
|
||||||
import httpx
|
import httpx
|
||||||
from fastapi import HTTPException
|
|
||||||
|
|
||||||
from app.api.url_upload import process_url
|
|
||||||
|
|
||||||
# The local validate_redirect hook intercepts 301/302 and throws an httpx.RequestError
|
# The local validate_redirect hook intercepts 301/302 and throws an httpx.RequestError
|
||||||
# Here we mock the behavior of that hook executing during the stream context
|
# Here we mock the behavior of that hook executing during the stream context
|
||||||
def side_effect(*args, **kwargs):
|
def side_effect(*args, **kwargs):
|
||||||
# Raise a simulated RequestError caused by validate_redirect
|
# Raise a simulated RequestError caused by validate_redirect
|
||||||
raise httpx.RequestError("Unsafe redirect target: Access to private IP addresses is not allowed", request=httpx.Request("GET", "http://example.com"))
|
raise httpx.RequestError(
|
||||||
|
"Unsafe redirect target: Access to private IP addresses is not allowed",
|
||||||
|
request=httpx.Request("GET", "http://example.com"),
|
||||||
|
)
|
||||||
|
|
||||||
mock_stream.side_effect = side_effect
|
mock_stream.side_effect = side_effect
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user