@@ -350,64 +350,93 @@ def test_get_file_header_none_with_presigned_url(tmp_path):
350350
351351
352352@pytest .mark .parametrize (
353- "region,return_url,use_regional_url,endpoint,use_virtual_url" ,
353+ "region,return_url,use_regional_url,endpoint,use_virtual_url,complete_url " ,
354354 [
355355 (
356356 "US-CENTRAL1" ,
357357 "https://storage.us-central1.rep.googleapis.com" ,
358358 True ,
359359 None ,
360360 False ,
361+ "https://storage.us-central1.rep.googleapis.com/location/filename" ,
361362 ),
362363 (
363364 "ME-CENTRAL2" ,
364365 "https://storage.me-central2.rep.googleapis.com" ,
365366 True ,
366367 None ,
367368 False ,
369+ "https://storage.me-central2.rep.googleapis.com/location/filename" ,
368370 ),
369- ("US-CENTRAL1" , "https://storage.googleapis.com" , False , None , False ),
370- ("US-CENTRAL1" , "https://storage.googleapis.com" , False , None , False ),
371- ("US-CENTRAL1" , "https://location.storage.googleapis.com" , False , None , True ),
372- ("US-CENTRAL1" , "https://location.storage.googleapis.com" , True , None , True ),
373371 (
374372 "US-CENTRAL1" ,
375- "https://overriddenurl .com" ,
373+ "https://storage.googleapis .com" ,
376374 False ,
377- "https://overriddenurl.com" ,
375+ None ,
378376 False ,
377+ "https://storage.googleapis.com/location/filename" ,
379378 ),
380379 (
381380 "US-CENTRAL1" ,
382- "https://overriddenurl .com" ,
381+ "https://storage.us-central1.rep.googleapis .com" ,
383382 True ,
384- "https://overriddenurl.com" ,
383+ None ,
385384 False ,
385+ "https://storage.us-central1.rep.googleapis.com/location/filename" ,
386386 ),
387387 (
388388 "US-CENTRAL1" ,
389- "https://overriddenurl.com" ,
389+ "https://location.storage.googleapis.com" ,
390+ False ,
391+ None ,
390392 True ,
391- "https://overriddenurl.com" ,
393+ "https://location.storage.googleapis.com/filename" ,
394+ ),
395+ (
396+ "US-CENTRAL1" ,
397+ "https://location.storage.googleapis.com" ,
392398 True ,
399+ None ,
400+ True ,
401+ "https://location.storage.googleapis.com/filename" ,
393402 ),
394403 (
395404 "US-CENTRAL1" ,
396405 "https://overriddenurl.com" ,
397406 False ,
398407 "https://overriddenurl.com" ,
399408 False ,
409+ "https://overriddenurl.com/location/filename" ,
410+ ),
411+ (
412+ "US-CENTRAL1" ,
413+ "https://overriddenurl.com" ,
414+ True ,
415+ "https://overriddenurl.com" ,
416+ False ,
417+ "https://overriddenurl.com/location/filename" ,
418+ ),
419+ (
420+ "US-CENTRAL1" ,
421+ "https://overriddenurl.com" ,
422+ True ,
423+ "https://overriddenurl.com" ,
424+ True ,
425+ "https://overriddenurl.com/filename" ,
400426 ),
401427 (
402428 "US-CENTRAL1" ,
403429 "https://overriddenurl.com" ,
404430 False ,
405431 "https://overriddenurl.com" ,
406432 True ,
433+ "https://overriddenurl.com/filename" ,
407434 ),
408435 ],
409436)
410- def test_url (region , return_url , use_regional_url , endpoint , use_virtual_url ):
437+ def test_url (
438+ region , return_url , use_regional_url , endpoint , use_virtual_url , complete_url
439+ ):
411440 gcs_location = SnowflakeGCSRestClient .get_location (
412441 stage_location = "location" ,
413442 use_regional_url = use_regional_url ,
@@ -417,6 +446,17 @@ def test_url(region, return_url, use_regional_url, endpoint, use_virtual_url):
417446 )
418447 assert gcs_location .endpoint == return_url
419448
449+ generated_url = SnowflakeGCSRestClient .generate_file_url (
450+ stage_location = "location" ,
451+ filename = "filename" ,
452+ use_regional_url = use_regional_url ,
453+ region = region ,
454+ endpoint = endpoint ,
455+ use_virtual_url = use_virtual_url ,
456+ )
457+
458+ assert generated_url == complete_url
459+
420460
421461@pytest .mark .parametrize (
422462 "region,use_regional_url,return_value" ,
0 commit comments