chore: apply ruff formatting and fix whitespace issues

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-13 09:12:11 +00:00
parent 43bc58770d
commit b03ebab747
96 changed files with 991 additions and 993 deletions
+14 -14
View File
@@ -10,7 +10,7 @@ Unlike unit tests that mock external dependencies, these integration tests use *
- **Redis** - Real message broker for Celery tasks
- **Gotenberg** - Real PDF conversion service
- **WebDAV Server** - Real upload target
- **SFTP Server** - Real SSH/SFTP server
- **SFTP Server** - Real SSH/SFTP server
- **MinIO** - Real S3-compatible object storage
- **FTP Server** - Real FTP server
@@ -202,15 +202,15 @@ def test_celery_tasks(celery_app, celery_worker):
def test_upload_to_webdav(webdav_container, sample_text_file):
"""Upload file to real WebDAV server and verify."""
from app.tasks.upload_to_webdav import upload_to_webdav
with patch("app.tasks.upload_to_webdav.settings") as mock_settings:
mock_settings.webdav_url = webdav_container["url"] + "/"
mock_settings.webdav_username = webdav_container["username"]
mock_settings.webdav_password = webdav_container["password"]
# Execute upload
result = upload_to_webdav.apply(args=[sample_text_file]).get()
# Verify on server
response = requests.get(
f"{webdav_container['url']}/test.txt",
@@ -226,14 +226,14 @@ def test_upload_to_webdav(webdav_container, sample_text_file):
def test_async_upload(redis_container, webdav_container, celery_worker, sample_text_file):
"""Queue task in Redis, worker executes, uploads to WebDAV."""
from app.tasks.upload_to_webdav import upload_to_webdav
# Queue task (goes to Redis)
result = upload_to_webdav.delay(sample_text_file, file_id=1)
# Wait for worker to process
while not result.ready():
time.sleep(0.5)
# Verify result
assert result.get()["status"] == "Completed"
```
@@ -299,9 +299,9 @@ Set a breakpoint after test to inspect:
```python
def test_inspect(webdav_container):
result = upload_file()
import pdb; pdb.set_trace() # Container still running here
# Manually inspect: docker ps, docker logs, etc.
```
@@ -391,24 +391,24 @@ on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
docker:
image: docker:latest
options: --privileged
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
- name: Run integration tests
run: |
pytest -m "integration or e2e" -v --tb=short
+1 -1
View File
@@ -98,7 +98,7 @@ async def test_oauth_callback(mock_authorize, oauth_enabled_app, test_user_info)
"access_token": "test-token",
"userinfo": test_user_info,
}
response = oauth_enabled_app.get("/oauth-callback?code=test-code")
assert response.status_code == 302 # Redirects after login
```
+6 -6
View File
@@ -244,9 +244,9 @@ class TestAzureDocumentIntelligenceIntegration:
assert len(result.content) > 10, f"OCR text too short: {result.content[:50]}"
# Verify the generated text is recognizable
assert "Acme" in result.content or "Invoice" in result.content, (
f"OCR text does not contain expected keywords: {result.content[:200]}"
)
assert (
"Acme" in result.content or "Invoice" in result.content
), f"OCR text does not contain expected keywords: {result.content[:200]}"
# Retrieve the searchable PDF output
operation_id = poller.details["operation_id"]
@@ -602,9 +602,9 @@ class TestFullOCRMetadataPipeline:
# The generated invoice should be classified reasonably
doc_type = metadata["document_type"].lower()
assert any(kw in doc_type for kw in ("invoice", "rechnung", "bill")), (
f"Unexpected document_type: {metadata['document_type']}"
)
assert any(
kw in doc_type for kw in ("invoice", "rechnung", "bill")
), f"Unexpected document_type: {metadata['document_type']}"
finally:
os.unlink(pdf_path)
+3 -3
View File
@@ -83,9 +83,9 @@ class TestSplitPdfBySize:
# that can cause files to exceed the target size by ~20-50%. We allow 1.5x (50%) margin.
PDF_OVERHEAD_MULTIPLIER = 1.5
for split_file in split_files:
assert os.path.getsize(split_file) <= max_size * PDF_OVERHEAD_MULTIPLIER, (
f"Split file {split_file} should respect size limit (with PDF overhead allowance)"
)
assert (
os.path.getsize(split_file) <= max_size * PDF_OVERHEAD_MULTIPLIER
), f"Split file {split_file} should respect size limit (with PDF overhead allowance)"
# Cleanup split files
for split_file in split_files:
+3 -3
View File
@@ -142,9 +142,9 @@ def test_x_frame_options_valid_value(client):
x_frame_value = response.headers["X-Frame-Options"]
valid_values = ["DENY", "SAMEORIGIN"]
# Note: ALLOW-FROM is deprecated in modern browsers; use CSP frame-ancestors instead
assert x_frame_value in valid_values or x_frame_value.startswith("ALLOW-FROM"), (
f"Invalid X-Frame-Options value: {x_frame_value}"
)
assert x_frame_value in valid_values or x_frame_value.startswith(
"ALLOW-FROM"
), f"Invalid X-Frame-Options value: {x_frame_value}"
@pytest.mark.integration
+3 -3
View File
@@ -305,9 +305,9 @@ class TestWebDAVIntegration:
response = requests.get(file_url, auth=(webdav_server["username"], webdav_server["password"]), timeout=10)
assert response.status_code == 200
assert len(response.content) == 1024 * 1024, (
f"File size mismatch: expected 1MB, got {len(response.content)} bytes"
)
assert (
len(response.content) == 1024 * 1024
), f"File size mismatch: expected 1MB, got {len(response.content)} bytes"
@pytest.mark.integration