"""Integration test fixtures.""" from typing import Callable import pytest from jwtauth.testing import JwtAuthSecretsManager, SecretLookupInfo from tests.integration.client import OwsContributor from tests.integration.constants import ( CONTRIBUTOR_UUIDS, GLOBAL_PARTICIPANT_UUIDS, PARTICIPATION_ROLE_CATEGORY_UUIDS, PRODUCT_IDS, UNKNOWN_CONTRIBUTOR_UUID, UNKNOWN_PARTICIPATION_ROLE_CATEGORY_UUID, UNKNOWN_PARTICIPATION_ROLE_UUID, UNKNOWN_PRODUCT_ID, VENDOR_ID, ) pytest_plugins = ["jwtauth.testing.pytest_plugin"] @pytest.fixture(scope="session") def jwt( generate_bearer_token: Callable[..., str], jwtauth_secrets_manager: JwtAuthSecretsManager, ) -> str: return generate_bearer_token( get_user_creds_args=SecretLookupInfo( environment="qa", service_name="ows-contributor-integration-test", secret_name="OWS_CONTRIBUTOR_INTEGRATION_TEST_USER_CREDENTIALS", ), get_auth0_creds_args=SecretLookupInfo( environment="qa", service_name="ows-contributor-integration-test", secret_name="OWS_CONTRIBUTOR_INTEGRATION_TEST_APP_AUTH0_CREDENTIALS", ), secrets_manager=jwtauth_secrets_manager, ) @pytest.fixture(scope="session") def client(jwt: str) -> OwsContributor: return OwsContributor(jwt=jwt) @pytest.fixture(scope="module") def vendor_id() -> int: return VENDOR_ID @pytest.fixture(scope="module") def product_id() -> int: return PRODUCT_IDS[0] @pytest.fixture(scope="module") def product_ids() -> list[int]: return PRODUCT_IDS @pytest.fixture(scope="module") def unknown_product_id() -> int: return UNKNOWN_PRODUCT_ID @pytest.fixture(scope="module") def contributor_uuid() -> str: return CONTRIBUTOR_UUIDS[0] @pytest.fixture(scope="module") def contributor_uuids() -> list[str]: return CONTRIBUTOR_UUIDS @pytest.fixture(scope="module") def unknown_contributor_uuid() -> str: return UNKNOWN_CONTRIBUTOR_UUID @pytest.fixture(scope="module") def global_participant_uuid() -> str: return GLOBAL_PARTICIPANT_UUIDS[0] @pytest.fixture(scope="module") def global_participant_uuids() -> list[str]: return GLOBAL_PARTICIPANT_UUIDS @pytest.fixture(scope="module") def participation_role_category_uuid() -> str: return PARTICIPATION_ROLE_CATEGORY_UUIDS[0] @pytest.fixture(scope="module") def participation_role_category_uuids() -> list[str]: return PARTICIPATION_ROLE_CATEGORY_UUIDS @pytest.fixture(scope="module") def unknown_participation_role_category_uuid() -> str: return UNKNOWN_PARTICIPATION_ROLE_CATEGORY_UUID @pytest.fixture(scope="module") def unknown_participation_role_uuid() -> str: return UNKNOWN_PARTICIPATION_ROLE_UUID