from typing import Any from uuid import uuid4 import pytest from common.schemas.asset_copy import CopyAssetEvent from src.common.schemas.ingestion import ProductInfo from src.common.test_data.event import event_data @pytest.fixture def correlation_id() -> str: return str(uuid4()) @pytest.fixture def upc() -> str: return str(event_data["product_info"]["product"]["upc"]) @pytest.fixture def product_id() -> int: return int(event_data["product_info"]["product"]["product_id"] or 123) @pytest.fixture def product_info() -> ProductInfo: return ProductInfo(**event_data["product_info"]) @pytest.fixture def project_code() -> str: return str(event_data["product_info"]["project"]["project_code"]) @pytest.fixture def vendor_id() -> str: """Mock vendor id (it's Kitty Wizard).""" return "32387" @pytest.fixture def uuid() -> str: """Mock UUID.""" return "7fed9a75-e4a7-494b-a167-b242a3f2e5b5" @pytest.fixture def create_project_duplicate_error_response(project_code: str) -> dict[str, Any]: return { "data": {"createProject": None}, "errors": [ { "message": "400: BAD REQUEST", "locations": [{"line": 1, "column": 37}], "path": ["createProject"], "extensions": { "response": { "url": "https://qa-ows-project-manager.theorchard.io/project", "status": 400, "statusText": "BAD REQUEST", "body": { "code": "validation_error", "message": { "project_code": { "validator": "used", "validator_value": True, "message": f"Project code '{project_code}' already exists", "deletions": "N", "existing_project_id": 6451637, } }, }, }, "code": "INTERNAL_SERVER_ERROR", "stacktrace": ["GraphQLError: 400: BAD REQUEST"], }, } ], } @pytest.fixture def copy_asset_event(correlation_id: str) -> CopyAssetEvent: return CopyAssetEvent.model_validate( { "bulk_session_id": "797bb512-b494-4d71-9dac-e69457fa43e3", "bulk_session_asset_file_id": "dee43aa4-dcd7-426c-b90f-1e09667394f1", "bulk_session_ingestion_id": "5b832566-e442-4d36-85b4-0f4b6dee87ee", "identity_uuid": "10436b38-5e11-472d-b6a4-bf1ee2b1b438", "correlation_id": correlation_id, "asset": { "source_file_location": "s3://qa-ows-product-staging/assets/35759371-0ff5-498a-adaa-3997668e583b", "source_filename": "test5.jpeg", "product_id": 6336531, }, } )