@@ -384,13 +384,16 @@ def stub_single_part_download(self):
384
384
self .stub_head (content_length = len (self .contents ))
385
385
self .stub_get_object (self .contents )
386
386
387
- def stub_get_object (self , full_contents , start_byte = 0 , end_byte = None ):
387
+ def stub_get_object (
388
+ self , full_contents , start_byte = 0 , end_byte = None , extra_params = None
389
+ ):
388
390
"""
389
391
Stubs out the get_object operation.
390
392
391
393
:param full_contents: The FULL contents of the object
392
394
:param start_byte: The first byte to grab.
393
395
:param end_byte: The last byte to grab.
396
+ :param extra_params: Extra request parameters to expect.
394
397
"""
395
398
get_object_response = {}
396
399
expected_params = {}
@@ -429,14 +432,18 @@ def stub_get_object(self, full_contents, start_byte=0, end_byte=None):
429
432
}
430
433
)
431
434
expected_params .update ({"Bucket" : self .bucket , "Key" : self .key })
435
+ if extra_params is not None :
436
+ expected_params .update (extra_params )
432
437
433
438
self .stubber .add_response (
434
439
method = 'get_object' ,
435
440
service_response = get_object_response ,
436
441
expected_params = expected_params ,
437
442
)
438
443
439
- def stub_multipart_download (self , contents , part_size , num_parts ):
444
+ def stub_multipart_download (
445
+ self , contents , part_size , num_parts , extra_params = None
446
+ ):
440
447
self .stub_head (content_length = len (contents ))
441
448
442
449
for i in range (num_parts ):
@@ -446,6 +453,7 @@ def stub_multipart_download(self, contents, part_size, num_parts):
446
453
full_contents = contents ,
447
454
start_byte = start_byte ,
448
455
end_byte = end_byte ,
456
+ extra_params = extra_params ,
449
457
)
450
458
451
459
def test_client_download (self ):
@@ -486,7 +494,10 @@ def test_object_download(self):
486
494
def test_multipart_download (self ):
487
495
self .contents = b'A' * 55
488
496
self .stub_multipart_download (
489
- contents = self .contents , part_size = 5 , num_parts = 11
497
+ contents = self .contents ,
498
+ part_size = 5 ,
499
+ num_parts = 11 ,
500
+ extra_params = {'IfMatch' : self .etag },
490
501
)
491
502
transfer_config = TransferConfig (
492
503
multipart_chunksize = 5 , multipart_threshold = 1 , max_concurrency = 1
@@ -506,7 +517,10 @@ def test_multipart_download(self):
506
517
def test_download_progress (self ):
507
518
self .contents = b'A' * 55
508
519
self .stub_multipart_download (
509
- contents = self .contents , part_size = 5 , num_parts = 11
520
+ contents = self .contents ,
521
+ part_size = 5 ,
522
+ num_parts = 11 ,
523
+ extra_params = {'IfMatch' : self .etag },
510
524
)
511
525
transfer_config = TransferConfig (
512
526
multipart_chunksize = 5 , multipart_threshold = 1 , max_concurrency = 1
0 commit comments