Skip to content

Commit 1f0bb6b

Browse files
committed
Update functional s3 tests
1 parent 3f777b2 commit 1f0bb6b

4 files changed

Lines changed: 31 additions & 5 deletions

File tree

tests/functional/s3/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,23 @@ def assert_in_operations_called(self, expected_operation_with_params):
7070
)
7171

7272
def head_object_response(self, **override_kwargs):
73-
response = {'ContentLength': 100, 'LastModified': '00:00:00Z'}
73+
response = {
74+
'ContentLength': 100,
75+
'LastModified': '00:00:00Z',
76+
'ETag': '"foo-1"',
77+
}
7478
response.update(override_kwargs)
7579
return response
7680

7781
def list_objects_response(self, keys, **override_kwargs):
7882
contents = []
7983
for key in keys:
80-
content = {'Key': key, 'LastModified': '00:00:00Z', 'Size': 100}
84+
content = {
85+
'Key': key,
86+
'LastModified': '00:00:00Z',
87+
'Size': 100,
88+
'ETag': '"foo-1"',
89+
}
8190
if override_kwargs:
8291
content.update(override_kwargs)
8392
contents.append(content)

tests/functional/s3/test_cp_command.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ def test_upload_deep_archive(self):
261261

262262
def test_operations_used_in_download_file(self):
263263
self.parsed_responses = [
264-
{"ContentLength": "100", "LastModified": "00:00:00Z"},
264+
{
265+
"ContentLength": "100",
266+
"LastModified": "00:00:00Z",
267+
'ETag': '"foo-1"',
268+
},
265269
{'ETag': '"foo-1"', 'Body': BytesIO(b'foo')},
266270
]
267271
cmdline = '%s s3://bucket/key.txt %s' % (
@@ -468,7 +472,11 @@ def test_cp_fails_with_utime_errors_but_continues(self):
468472
full_path = self.files.create_file('foo.txt', '')
469473
cmdline = '%s s3://bucket/key.txt %s' % (self.prefix, full_path)
470474
self.parsed_responses = [
471-
{"ContentLength": "100", "LastModified": "00:00:00Z"},
475+
{
476+
"ContentLength": "100",
477+
"LastModified": "00:00:00Z",
478+
"ETag": '"foo-1"',
479+
},
472480
{'ETag': '"foo-1"', 'Body': BytesIO(b'foo')},
473481
]
474482
with mock.patch('os.utime') as mock_utime:
@@ -486,6 +494,7 @@ def test_recursive_glacier_download_with_force_glacier(self):
486494
'LastModified': '00:00:00Z',
487495
'StorageClass': 'GLACIER',
488496
'Size': 100,
497+
'ETag': '"foo-1"',
489498
},
490499
],
491500
'CommonPrefixes': [],
@@ -1326,12 +1335,14 @@ def test_ranged_download(self):
13261335
'mykey',
13271336
Range=mock.ANY,
13281337
RequestPayer='requester',
1338+
IfMatch='"foo-1"',
13291339
),
13301340
self.get_object_request(
13311341
'mybucket',
13321342
'mykey',
13331343
Range=mock.ANY,
13341344
RequestPayer='requester',
1345+
IfMatch='"foo-1"',
13351346
),
13361347
]
13371348
)

tests/functional/s3/test_mv_command.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ def test_download_move_with_request_payer(self):
124124

125125
self.parsed_responses = [
126126
# Response for HeadObject
127-
{"ContentLength": 100, "LastModified": "00:00:00Z"},
127+
{
128+
"ContentLength": 100,
129+
"LastModified": "00:00:00Z",
130+
"ETag": '"foo-1"',
131+
},
128132
# Response for GetObject
129133
{'ETag': '"foo-1"', 'Body': BytesIO(b'foo')},
130134
# Response for DeleteObject

tests/functional/s3/test_sync_command.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def test_sync_to_non_existant_directory(self):
7777
"Key": key,
7878
"Size": 3,
7979
"LastModified": "2014-01-09T20:45:49.000Z",
80+
"ETag": '"c8afdb36c52cf4727836669019e69222-"',
8081
}
8182
],
8283
},
@@ -125,6 +126,7 @@ def test_glacier_sync_with_force_glacier(self):
125126
'LastModified': '00:00:00Z',
126127
'StorageClass': 'GLACIER',
127128
'Size': 100,
129+
'ETag': '"foo-1"',
128130
},
129131
],
130132
'CommonPrefixes': [],

0 commit comments

Comments
 (0)