اضافه شدن قابلیت رندر پی سی بی
Verify / test (push) Failing after 20s

This commit is contained in:
2026-11-09 12:34:50 +03:30
والد a599086c11
کامیت 4eb2cb3d6f
33فایلهای تغییر یافته به همراه2470 افزوده شده و 28 حذف شده
@@ -1,19 +1,21 @@
"""Protocol-level S3 contract check with botocore's validation stub (no live S3)."""
import io
import pytest
import boto3
from botocore.response import StreamingBody
from botocore.stub import Stubber
from app.storage import Storage
def test_s3_private_round_trip_contract(tmp_path,monkeypatch):
@pytest.mark.parametrize('name', ['input.SchDoc', 'input.PcbDoc', 'old.PcbDoc', 'new.PcbDoc', 'pcb-comparison.json', 'attempt-1/old.svg'])
def test_s3_private_round_trip_contract(tmp_path,monkeypatch,name):
from app.config import settings
from app.storage import storage
monkeypatch.setenv('STORAGE_DIR',str(tmp_path)); monkeypatch.setenv('S3_BUCKET','test-private')
settings.cache_clear(); storage.cache_clear()
client=boto3.client('s3',region_name='us-east-1',aws_access_key_id='test',aws_secret_access_key='test')
monkeypatch.setattr(boto3,'client',lambda *a,**kw:client)
key='a'*48+'/input.SchDoc'; payload=b'actual bytes'
key='a'*48+'/'+name; payload=b'actual bytes'
with Stubber(client) as stub:
stub.add_response('put_object',{}, {'Bucket':'test-private','Key':key,'Body':payload,'ContentType':'application/octet-stream'})
stub.add_response('get_object',{'Body':StreamingBody(io.BytesIO(payload),len(payload))},{'Bucket':'test-private','Key':key})