"""Pytest conftest module for create_project tests.""" import pytest @pytest.fixture def context_event(): """State machine input event.""" return { 'project': { 'name': 'Test Project', 'project_code': '1074641', 'project_id': None, 'artist': {'name': 'Fritz Wunderlich'}, }, 'product': { 'upc': '886443197781', 'product_name': 'Test Product', 'vendor_id': 34563, 'subaccount_id': 57803, }, 'label_participants': [ { 'name': 'Fritz Wunderlich', 'artist_id': '11111', 'label_participant_id': '22222', 'label_participant_uuid': 'UUID-AAA', }, ], } # productByUpc responses @pytest.fixture def get_product_by_upc_no_project(): """Return product with no project attached.""" return { 'data': { 'productByUpc': { 'vendorId': 34563, 'project': None, } } } @pytest.fixture def get_product_by_upc_matching_project(): """Return product whose project code matches the context.""" return { 'data': { 'productByUpc': { 'vendorId': 34563, 'project': { 'projectCode': '1074641', 'projectId': 9001, }, } } } @pytest.fixture def get_product_by_upc_mismatched_project(): """Return product whose project code differs from the context.""" return { 'data': { 'productByUpc': { 'vendorId': 34563, 'project': { 'projectCode': '9999999', 'projectId': 8888, }, } } } @pytest.fixture def get_product_by_upc_no_result(): """Return null productByUpc (UPC not yet known).""" return { 'data': { 'productByUpc': None, } } # projectByProjectCode responses @pytest.fixture def get_project_found(): """Return an existing project from projectByProjectCode.""" return { 'data': { 'projectByProjectCode': { 'projectId': 9001, } } } @pytest.fixture def get_project_not_found(): """Return null from projectByProjectCode (project does not exist).""" return { 'data': { 'projectByProjectCode': None, } } # createProject response @pytest.fixture def create_project_response(): """Return a successful createProject mutation response.""" return { 'data': { 'createProject': { 'projectId': 9002, } } }