Add structured logging module for verification events (#28)

This commit is contained in:
Mondo Diaz
2026-01-07 12:42:50 -06:00
parent 9cb5cff526
commit 38160f2e44
4 changed files with 308 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ These tests verify:
import pytest
import hashlib
import base64
import io
# =============================================================================
@@ -20,11 +21,31 @@ import base64
@pytest.fixture
def test_content():
"""Generate test content with known hash."""
content = b"Test content for download verification"
sha256 = hashlib.sha256(content).hexdigest()
return content, sha256
def upload_test_file(integration_client):
"""
Factory fixture to upload a test file and return its artifact ID.
Usage:
artifact_id = upload_test_file(project, package, content, tag="v1.0")
"""
def _upload(project_name: str, package_name: str, content: bytes, tag: str = None):
files = {
"file": ("test-file.bin", io.BytesIO(content), "application/octet-stream")
}
data = {}
if tag:
data["tag"] = tag
response = integration_client.post(
f"/api/v1/project/{project_name}/{package_name}/upload",
files=files,
data=data,
)
assert response.status_code == 200, f"Upload failed: {response.text}"
return response.json()["artifact_id"]
return _upload
# =============================================================================