diff --git a/google/cloud/storage/client.py b/google/cloud/storage/client.py index 9cccf413b..e0b2af1ff 100644 --- a/google/cloud/storage/client.py +++ b/google/cloud/storage/client.py @@ -20,6 +20,7 @@ import datetime import functools import json +import os import warnings import google.api_core.client_options @@ -1761,7 +1762,10 @@ def generate_signed_post_policy_v4( elif bucket_bound_hostname: url = f"{_bucket_bound_hostname_url(bucket_bound_hostname, scheme)}/" else: - url = f"https://storage.googleapis.com/{bucket_name}/" + api_access_endpoint = os.getenv( + "API_ENDPOINT_OVERRIDE", "https://storage.googleapis.com" + ) + url = f"{api_access_endpoint}/{bucket_name}/" return {"url": url, "fields": policy_fields} diff --git a/tests/system/test__signing.py b/tests/system/test__signing.py index f6b81d7cb..3e8ca1752 100644 --- a/tests/system/test__signing.py +++ b/tests/system/test__signing.py @@ -16,7 +16,6 @@ import datetime import hashlib import os -import pytest import time import requests @@ -380,10 +379,6 @@ def test_create_signed_resumable_upload_url_v4(storage_client, signing_bucket, n ) -@pytest.mark.skipif( - "API_ENDPOINT_OVERRIDE" in os.environ, - reason="Failing test for the overriding endpoint", -) def test_generate_signed_post_policy_v4( storage_client, buckets_to_delete, blobs_to_delete, service_account, no_mtls ):