@@ -350,64 +350,93 @@ def test_get_file_header_none_with_presigned_url(tmp_path):
350
350
351
351
352
352
@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 " ,
354
354
[
355
355
(
356
356
"US-CENTRAL1" ,
357
357
"https://storage.us-central1.rep.googleapis.com" ,
358
358
True ,
359
359
None ,
360
360
False ,
361
+ "https://storage.us-central1.rep.googleapis.com/location/filename" ,
361
362
),
362
363
(
363
364
"ME-CENTRAL2" ,
364
365
"https://storage.me-central2.rep.googleapis.com" ,
365
366
True ,
366
367
None ,
367
368
False ,
369
+ "https://storage.me-central2.rep.googleapis.com/location/filename" ,
368
370
),
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 ),
373
371
(
374
372
"US-CENTRAL1" ,
375
- "https://overriddenurl .com" ,
373
+ "https://storage.googleapis .com" ,
376
374
False ,
377
- "https://overriddenurl.com" ,
375
+ None ,
378
376
False ,
377
+ "https://storage.googleapis.com/location/filename" ,
379
378
),
380
379
(
381
380
"US-CENTRAL1" ,
382
- "https://overriddenurl .com" ,
381
+ "https://storage.us-central1.rep.googleapis .com" ,
383
382
True ,
384
- "https://overriddenurl.com" ,
383
+ None ,
385
384
False ,
385
+ "https://storage.us-central1.rep.googleapis.com/location/filename" ,
386
386
),
387
387
(
388
388
"US-CENTRAL1" ,
389
- "https://overriddenurl.com" ,
389
+ "https://location.storage.googleapis.com" ,
390
+ False ,
391
+ None ,
390
392
True ,
391
- "https://overriddenurl.com" ,
393
+ "https://location.storage.googleapis.com/filename" ,
394
+ ),
395
+ (
396
+ "US-CENTRAL1" ,
397
+ "https://location.storage.googleapis.com" ,
392
398
True ,
399
+ None ,
400
+ True ,
401
+ "https://location.storage.googleapis.com/filename" ,
393
402
),
394
403
(
395
404
"US-CENTRAL1" ,
396
405
"https://overriddenurl.com" ,
397
406
False ,
398
407
"https://overriddenurl.com" ,
399
408
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" ,
400
426
),
401
427
(
402
428
"US-CENTRAL1" ,
403
429
"https://overriddenurl.com" ,
404
430
False ,
405
431
"https://overriddenurl.com" ,
406
432
True ,
433
+ "https://overriddenurl.com/filename" ,
407
434
),
408
435
],
409
436
)
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
+ ):
411
440
gcs_location = SnowflakeGCSRestClient .get_location (
412
441
stage_location = "location" ,
413
442
use_regional_url = use_regional_url ,
@@ -417,6 +446,17 @@ def test_url(region, return_url, use_regional_url, endpoint, use_virtual_url):
417
446
)
418
447
assert gcs_location .endpoint == return_url
419
448
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
+
420
460
421
461
@pytest .mark .parametrize (
422
462
"region,use_regional_url,return_value" ,
0 commit comments