Исправлены ошибки, выявленные на тесте инфраструктуры

This commit is contained in:
mi
2026-07-15 13:18:30 +03:00
parent 6d1cb3d6d9
commit caf6bf0516
8 changed files with 137 additions and 19 deletions
@@ -1,4 +1,5 @@
import uuid
from urllib.parse import urlsplit
import httpx
import pytest
@@ -6,6 +7,7 @@ import pytest
from app.integrations import (
DependencyFailure,
OpenLinesClient,
S3Client,
SafetyClient,
fresh_openlines_payload,
)
@@ -39,6 +41,19 @@ def settings() -> Settings:
return Settings.model_validate(common)
@pytest.mark.asyncio
async def test_s3_presigned_urls_use_virtual_hosted_addressing() -> None:
s3 = S3Client(settings())
put_url = await s3.presign_put("quarantine/users/u/file.pdf", "application/pdf", 600)
get_url = await s3.presign_get("attachments", "dialogs/d/file.pdf")
assert urlsplit(put_url).netloc == "quarantine.s3.example"
assert urlsplit(put_url).path == "/quarantine/users/u/file.pdf"
assert urlsplit(get_url).netloc == "attachments.s3.example"
assert urlsplit(get_url).path == "/dialogs/d/file.pdf"
@pytest.mark.asyncio
async def test_safety_contract_status_and_service_token() -> None:
async def handler(request: httpx.Request) -> httpx.Response: