"""Constants for ows-carveouts-python integration tests. These integration tests run against a deployed environment (QA_BASE_URL, default QA). Everything that varies per environment/dataset is read from the environment so the same suite can target QA, a review app, or a local container without code changes. Only endpoints actually implemented by the service (see carveouts/handlers.py) are represented here. The specced-but-unimplemented read endpoints (/products/{id}/carveouts, /vendor/{id}/carveouts, ...) are intentionally omitted until their handlers land. """ from os import getenv # Base URL of the deployed service under test. tests/integration/__init__.py # sets a default, but we repeat it here so this module is usable standalone. BASE_URL = getenv("QA_BASE_URL", "https://qa-ows-carveouts-python.theorchard.io") # Per-request timeout (seconds); overridable for slower environments. REQUEST_TIMEOUT = float(getenv("REQUEST_TIMEOUT", "30")) # --------------------------------------------------------------------------- # Endpoints (carveouts/handlers.py) # --------------------------------------------------------------------------- # Health check (config.HEALTH_CHECK). HEALTH_CHECK = BASE_URL + "/hello/" # Release-level DMS carveout deletes (grass-header + ownership guarded). DELETE_RELEASE_DMS = BASE_URL + "/release_dms_carveouts/{product_id}" DELETE_RELEASE_DMS_MASTER = BASE_URL + "/release_dms_master_carveouts/{product_id}" # Vendor-contract store-carveout dataloader (OrchAdminProfile guarded). DATALOADER = BASE_URL + "/vendor-contract-store-carveouts-dataloader" # A path that maps to no route. A deep, multi-segment path is used (rather than # a single unknown segment) to minimise the chance of colliding with a real or # future top-level route, so this reliably exercises the 404 path. UNKNOWN_ROUTE = BASE_URL + "/this/route/does/not/exist" # --------------------------------------------------------------------------- # GRASS auth headers (carveouts/constants/header.py). # --------------------------------------------------------------------------- GRASS_ACCOUNT_TYPE_HEADER = "Grass-Account-Type" GRASS_ACCOUNT_ID_HEADER = "Grass-Account-Id" # --------------------------------------------------------------------------- # Opt-in test data. Defaults to None so data/auth-dependent tests SKIP unless # the operator supplies values that are valid (and, for writes, throwaway) on # the target environment. # --------------------------------------------------------------------------- # Ownership-rejection (403) path: a real product id plus a grass account that # does NOT own it. This 403s before any delete, so it does not mutate data. NONOWNER_PRODUCT_ID = getenv("TEST_NONOWNER_PRODUCT_ID") NONOWNER_ACCOUNT_TYPE = getenv("TEST_NONOWNER_ACCOUNT_TYPE", "vendor") NONOWNER_ACCOUNT_ID = getenv("TEST_NONOWNER_ACCOUNT_ID") # Successful-delete (write) path: a throwaway product id plus a grass account # that owns it. Running these mutates data, so they are gated behind the # `write` marker AND require these vars. WRITE_PRODUCT_ID = getenv("TEST_WRITE_PRODUCT_ID") WRITE_ACCOUNT_TYPE = getenv("TEST_WRITE_ACCOUNT_TYPE", "vendor") WRITE_ACCOUNT_ID = getenv("TEST_WRITE_ACCOUNT_ID") # Dataloader auth: the route requires an OrchAdminProfile (access_rules.yml), # so its tests need an authenticated admin caller. Supply the header name and # value that grant admin access on the target environment. ADMIN_AUTH_HEADER = getenv("TEST_ADMIN_AUTH_HEADER") ADMIN_AUTH_VALUE = getenv("TEST_ADMIN_AUTH_VALUE") # A (vendor_contract_id, delivery_store_id) pair known to exist, used by the # dataloader happy-path assertion. DATALOADER_VENDOR_CONTRACT_ID = getenv("TEST_DATALOADER_VENDOR_CONTRACT_ID") DATALOADER_DELIVERY_STORE_ID = getenv("TEST_DATALOADER_DELIVERY_STORE_ID")