"""Constants for api tests.""" from os import getenv # urls BASE_URL = getenv("BASE_URL", "https://qa-ows-carveouts.theorchard.io") #Release RELEASE_STORE = BASE_URL + "/carveout/release/{upc}/dms" RELEASE_TERRITORY = BASE_URL + "/carveout/release/{upc}/territory" RELEASE_SUBSTORE = BASE_URL + "/carveout/release/{upc}/territory/{dms_id}" RELEASE_ALL = BASE_URL + "/carveout/release/{upc}" # vendor VENDOR_STORE = BASE_URL + "/carveout/vendor/{vendor_id}/dms" VENDOR_TERRITORY = BASE_URL + "/carveout/vendor/{vendor_id}/territory" VENDOR_SUBSTORE = BASE_URL + "/carveout/vendor/{vendor_id}/territory/{dms_id}" VENDOR_ALL = BASE_URL + "/carveout/vendor/{vendor_id}" # subaccount SUBACCOUNT_STORE = BASE_URL + "/carveout/subaccount/{subaccount_id}/dms" SUBACCOUNT_TERRITORY = BASE_URL + "/carveout/subaccount/{subaccount_id}/territory" SUBACCOUNT_SUBSTORE = BASE_URL + "/carveout/subaccount/{subaccount_id}/territory/{dms_id}" SUBACCOUNT_ALL = BASE_URL + "/carveout/subaccount/{subaccount_id}" # combined COMBINED_STORE = BASE_URL + "/carveout/{upc}/dms" COMBINED_TERRITORY = BASE_URL + "/carveout/{upc}/territory" COMBINED_SUBSTORE = BASE_URL + "/carveout/{upc}/territory/{dms_id}" COMBINED_ALL = BASE_URL + "/carveout/{upc}" # combined - projection & structured (read-only, previously uncovered) PROJECTION = BASE_URL + "/carveout/projection/{upc}/dms/{dms_id}" STRUCTURED_TERRITORY = BASE_URL + "/carveout/{upc}/territory/structured" # store list (previously only /stores was covered) STORE_LIST = BASE_URL + "/stores" STORE_BY_ID = BASE_URL + "/store/{store_id}" STORES_BY_CLASSIFICATION = BASE_URL + "/stores/{classification}" STORES_GRATS = BASE_URL + "/stores/grats" # health check (resources/config/prod.php -> $app['health_check']) HEALTH_CHECK = BASE_URL + "/hello/" # Test data (env-overridable so the suite can target other environments/datasets) UPC = getenv("TEST_UPC", "191018928940") TERRITORY_UPC = getenv("TEST_TERRITORY_UPC", "669910000083") SUBSTORE_UPC = getenv("TEST_SUBSTORE_UPC", "669910001387") VENDOR_ID = getenv("TEST_VENDOR_ID", "7570") SUBSTORE_VENDOR_ID = getenv("TEST_SUBSTORE_VENDOR_ID", "26351") SUBSTORE_DMS_ID = getenv("TEST_SUBSTORE_DMS_ID", "1245") SUBACCOUNT_ID = getenv("TEST_SUBACCOUNT_ID", "18") SUBACCOUNT_DMS_ID = getenv("TEST_SUBACCOUNT_DMS_ID", "312") DMS_ID = getenv("TEST_DMS_ID", "3") # A store id known to exist in the store list (496 == Google Music, asserted today) STORE_ID = getenv("TEST_STORE_ID", "496") # Valid store classifications accepted by the /stores/{classification} route # (see RoutesLoader assert: physical|nr-performer|nr-owner, case-insensitive) STORE_CLASSIFICATIONS = ("physical", "nr-performer", "nr-owner") # GRASS auth header names (src/Constants/Headers.php) used by structured-territory GRASS_ACCOUNT_TYPE_HEADER = "Grass-Account-Type" GRASS_ACCOUNT_ID_HEADER = "Grass-Account-Id" # --------------------------------------------------------------------------- # Write endpoints (mounted under /admin/bulkupdate and /carveout/product/*). # --------------------------------------------------------------------------- BULK_STORE = BASE_URL + "/admin/bulkupdate/product/store" BULK_STORE_REPLACE = BASE_URL + "/admin/bulkupdate/product/storereplace" BULK_SUBSTORE = BASE_URL + "/admin/bulkupdate/product/substore" BULK_TERRITORY = BASE_URL + "/admin/bulkupdate/product/territory" BULK_TERRITORY_REPLACE = BASE_URL + "/admin/bulkupdate/product/territoryreplace" BULK_DEFAULT_STORE = BASE_URL + "/admin/bulkupdate/product/defaultstore" BULK_DEFAULT_STORE_REPLACE = BASE_URL + "/admin/bulkupdate/product/defaultstorereplace" PUT_TERRITORY = BASE_URL + "/carveout/{upc}/territory" COPY_TERRITORIES = BASE_URL + "/carveout/product/{product_id}/copy/{new_product_id}" # --------------------------------------------------------------------------- # Write-test data. Defaults to None so the data-mutating lifecycle tests SKIP # unless the operator explicitly supplies throwaway IDs that are safe to # create/delete on the target environment. The validation tests below need # none of this and always run (they 400 before any mutation). # --------------------------------------------------------------------------- def _int_list(name): raw = getenv(name, "") return [int(x) for x in raw.split(",") if x.strip()] WRITE_PRODUCT_ID = getenv("TEST_WRITE_PRODUCT_ID") WRITE_NEW_PRODUCT_ID = getenv("TEST_WRITE_NEW_PRODUCT_ID") WRITE_UPC = getenv("TEST_WRITE_UPC") WRITE_STORE_ID = getenv("TEST_WRITE_STORE_ID") WRITE_DISTRIBUTION_TYPE_IDS = _int_list("TEST_WRITE_DISTRIBUTION_TYPE_IDS") WRITE_COUNTRY_ID = getenv("TEST_WRITE_COUNTRY_ID") WRITE_SUBSTORE_ID = getenv("TEST_WRITE_SUBSTORE_ID") # Orchard user id header used for carveout-history attribution on writes. ORCHARD_USER_ID = getenv("TEST_ORCHARD_USER_ID", "oa:1") # Attribution header sent on write requests (shared by the lifecycle and # validation suites so the header name lives in exactly one place). WRITE_HEADERS = {"Orchard-User-Id": ORCHARD_USER_ID}