from typing import Any import pytest from common.schemas.ingestion import ProductInfo, Project, ProjectArtist from common.test_data.event import event_data from src.connectors.graphql import ProjectIdResult @pytest.fixture def vendor_id() -> int: return int(event_data["product_info"]["product"]["vendor_id"] or 1) @pytest.fixture def subaccount_id() -> int: return int(event_data["product_info"]["product"]["subaccount_id"] or 1) @pytest.fixture def project_code() -> str: return str(event_data["product_info"]["project"]["project_code"]) @pytest.fixture def project_id() -> int: return int(event_data["product_info"]["project"]["project_id"] or 123) @pytest.fixture def project_artist_id() -> int: return int(event_data["product_info"]["project"]["artist"]["artist_id"] or 1) @pytest.fixture def event() -> dict[str, Any]: event_data["product_info"]["project"]["project_id"] = None return event_data @pytest.fixture def product_info_model(event: dict[str, Any]) -> ProductInfo: return ProductInfo(**event["product_info"]) @pytest.fixture def project_model(project_code: str, project_artist_id: int) -> Project: return Project( project_id=None, project_code=project_code, name="Project Name", description="Project Description", artist=ProjectArtist( name="Project Artist", artist_id=project_artist_id, sequence_number=1, apple_id=None, spotify_uri=None, ), ) @pytest.fixture def project_id_result_model(project_id: int) -> ProjectIdResult: return ProjectIdResult(**{"projectId": project_id}) @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 identity_uuid() -> str: return str(event_data["identity_uuid"]) @pytest.fixture def correlation_id() -> str: return "db8339cd-b2a6-4513-b7cc-61c4f935aeec" @pytest.fixture def bulk_session_ingestion_id() -> str: return "eb46599a-ab00-4946-b922-8b8c5a7acaf1" @pytest.fixture def bulk_session_ingestion_project_id() -> str: return "1c8ad45b-1b6e-4b33-93ae-3efc0576eb68"