"""Integration tests for policy metadata cache behavior on /{identity_uuid}/check/resources.""" # noqa: E501 from typing import Any, Dict import requests from mypy_boto3_dynamodb import DynamoDBClient from tests.integration import config from tests.integration.conftest import seed_test_pp_identity async def test_check_identity_resources_500_when_policy_metadata_cache_missing( default_boto_client: DynamoDBClient, bearer_token_pdptest_user: str, bearer_token_pdptest_user_identity_uuid: str, policy_metadata_cache_key_absent: None, ) -> None: """Returns 500 when cerbos_policy_metadata is absent. Requires pp_vendor_features_lookup to be on. """ seed_test_pp_identity( default_boto_client, bearer_token_pdptest_user_identity_uuid, "42879e8c-9f47-4214-b611-1e6feb0be6af", "audience_development_analyst", ) body: Dict[str, Any] = { "resources": [ { "resource": { "resource_id": "890", "resource_type": "fan_data_list", "attributes": { "tenant": { "tenant_type": "account", "tenant_uuid": "42879e8c-9f47-4214-b611-1e6feb0be6af", } }, }, "action": "view", } ] } response = requests.post( f"{config.QA_BASE_URL}/identity/{bearer_token_pdptest_user_identity_uuid}/check/resources/", # noqa: E501 json=body, headers={"Authorization": f"Bearer {bearer_token_pdptest_user}"}, ) assert response.status_code == 500, response.text