Skip to content

Commit 566b7d7

Browse files
authored
Merge pull request #4532 from boto/check-etag
Update multidownload tests to expect IfMatch
2 parents 9ef4493 + ab39e94 commit 566b7d7

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

tests/functional/test_s3.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,16 @@ def stub_single_part_download(self):
384384
self.stub_head(content_length=len(self.contents))
385385
self.stub_get_object(self.contents)
386386

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+
):
388390
"""
389391
Stubs out the get_object operation.
390392
391393
:param full_contents: The FULL contents of the object
392394
:param start_byte: The first byte to grab.
393395
:param end_byte: The last byte to grab.
396+
:param extra_params: Extra request parameters to expect.
394397
"""
395398
get_object_response = {}
396399
expected_params = {}
@@ -429,14 +432,18 @@ def stub_get_object(self, full_contents, start_byte=0, end_byte=None):
429432
}
430433
)
431434
expected_params.update({"Bucket": self.bucket, "Key": self.key})
435+
if extra_params is not None:
436+
expected_params.update(extra_params)
432437

433438
self.stubber.add_response(
434439
method='get_object',
435440
service_response=get_object_response,
436441
expected_params=expected_params,
437442
)
438443

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+
):
440447
self.stub_head(content_length=len(contents))
441448

442449
for i in range(num_parts):
@@ -446,6 +453,7 @@ def stub_multipart_download(self, contents, part_size, num_parts):
446453
full_contents=contents,
447454
start_byte=start_byte,
448455
end_byte=end_byte,
456+
extra_params=extra_params,
449457
)
450458

451459
def test_client_download(self):
@@ -486,7 +494,10 @@ def test_object_download(self):
486494
def test_multipart_download(self):
487495
self.contents = b'A' * 55
488496
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},
490501
)
491502
transfer_config = TransferConfig(
492503
multipart_chunksize=5, multipart_threshold=1, max_concurrency=1
@@ -506,7 +517,10 @@ def test_multipart_download(self):
506517
def test_download_progress(self):
507518
self.contents = b'A' * 55
508519
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},
510524
)
511525
transfer_config = TransferConfig(
512526
multipart_chunksize=5, multipart_threshold=1, max_concurrency=1

0 commit comments

Comments
 (0)