@@ -778,8 +778,11 @@ def dummy_service_account():
778
778
return _DUMMY_SERVICE_ACCOUNT
779
779
780
780
781
+ _API_ACCESS_ENDPOINT = "https://storage.googleapis.com"
782
+
783
+
781
784
def _run_conformance_test (
782
- resource , test_data , api_access_endpoint = "https://storage.googleapis.com"
785
+ resource , test_data , api_access_endpoint = _API_ACCESS_ENDPOINT
783
786
):
784
787
credentials = dummy_service_account ()
785
788
url = Test_generate_signed_url_v4 ._call_fut (
@@ -804,29 +807,37 @@ def test_conformance_client(test_data):
804
807
805
808
@pytest .mark .parametrize ("test_data" , _BUCKET_TESTS )
806
809
def test_conformance_bucket (test_data ):
810
+ global _API_ACCESS_ENDPOINT
807
811
if "urlStyle" in test_data and test_data ["urlStyle" ] == "BUCKET_BOUND_HOSTNAME" :
808
- api_access_endpoint = "{scheme}://{bucket_bound_hostname}" .format (
812
+ _API_ACCESS_ENDPOINT = "{scheme}://{bucket_bound_hostname}" .format (
809
813
scheme = test_data ["scheme" ],
810
814
bucket_bound_hostname = test_data ["bucketBoundHostname" ],
811
815
)
812
816
resource = "/"
813
- _run_conformance_test (resource , test_data , api_access_endpoint )
817
+ _run_conformance_test (resource , test_data , _API_ACCESS_ENDPOINT )
814
818
else :
815
819
resource = "/{}" .format (test_data ["bucket" ])
816
820
_run_conformance_test (resource , test_data )
817
821
818
822
819
823
@pytest .mark .parametrize ("test_data" , _BLOB_TESTS )
820
824
def test_conformance_blob (test_data ):
821
- if "urlStyle" in test_data and test_data ["urlStyle" ] == "BUCKET_BOUND_HOSTNAME" :
822
- api_access_endpoint = "{scheme}://{bucket_bound_hostname}" .format (
823
- scheme = test_data ["scheme" ],
824
- bucket_bound_hostname = test_data ["bucketBoundHostname" ],
825
- )
825
+ global _API_ACCESS_ENDPOINT
826
+ if "urlStyle" in test_data :
827
+ if test_data ["urlStyle" ] == "BUCKET_BOUND_HOSTNAME" :
828
+ _API_ACCESS_ENDPOINT = "{scheme}://{bucket_bound_hostname}" .format (
829
+ scheme = test_data ["scheme" ],
830
+ bucket_bound_hostname = test_data ["bucketBoundHostname" ],
831
+ )
832
+
833
+ # For the VIRTUAL_HOSTED_STYLE
834
+ else :
835
+ _API_ACCESS_ENDPOINT = "{scheme}://{bucket_name}.storage.googleapis.com" .format (
836
+ scheme = test_data ["scheme" ], bucket_name = test_data ["bucket" ]
837
+ )
826
838
resource = "/{}" .format (test_data ["object" ])
827
- _run_conformance_test (resource , test_data , api_access_endpoint )
839
+ _run_conformance_test (resource , test_data , _API_ACCESS_ENDPOINT )
828
840
else :
829
-
830
841
resource = "/{}/{}" .format (test_data ["bucket" ], test_data ["object" ])
831
842
_run_conformance_test (resource , test_data )
832
843
0 commit comments