Настроен файлообмен
This commit is contained in:
@@ -229,6 +229,7 @@ class S3Client:
|
||||
aws_access_key_id=settings.selectel_s3_access_key.get_secret_value(),
|
||||
aws_secret_access_key=settings.selectel_s3_secret_key.get_secret_value(),
|
||||
config=Config(
|
||||
signature_version="s3v4",
|
||||
connect_timeout=3,
|
||||
read_timeout=10,
|
||||
retries={"max_attempts": 2},
|
||||
|
||||
@@ -7,7 +7,7 @@ from typing import Any
|
||||
|
||||
from redis.asyncio import Redis
|
||||
|
||||
CHANNEL_PREFIX = "han:realtime:dialog:"
|
||||
CHANNEL_PREFIX = "han:rt:dialog:"
|
||||
|
||||
|
||||
class LocalFanout:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import uuid
|
||||
from urllib.parse import urlsplit
|
||||
from urllib.parse import parse_qs, urlsplit
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
@@ -11,6 +11,7 @@ from app.integrations import (
|
||||
SafetyClient,
|
||||
fresh_openlines_payload,
|
||||
)
|
||||
from app.realtime import CHANNEL_PREFIX
|
||||
from app.settings import Settings
|
||||
|
||||
|
||||
@@ -41,6 +42,10 @@ def settings() -> Settings:
|
||||
return Settings.model_validate(common)
|
||||
|
||||
|
||||
def test_realtime_channel_matches_redis_acl_namespace() -> None:
|
||||
assert CHANNEL_PREFIX == "han:rt:dialog:"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_s3_presigned_urls_use_virtual_hosted_addressing() -> None:
|
||||
s3 = S3Client(settings())
|
||||
@@ -52,6 +57,8 @@ async def test_s3_presigned_urls_use_virtual_hosted_addressing() -> None:
|
||||
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"
|
||||
assert parse_qs(urlsplit(put_url).query)["X-Amz-Algorithm"] == ["AWS4-HMAC-SHA256"]
|
||||
assert parse_qs(urlsplit(get_url).query)["X-Amz-Algorithm"] == ["AWS4-HMAC-SHA256"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user