Skip to content

Commit

Permalink
Made updates according to feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
aemous committed Oct 1, 2024
1 parent eb382cf commit 8eb168d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .changes/next-release/feature-s3-46667.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "feature",
"category": "s3",
"description": "Adds support for checksums other than MD5 to high-level S3 commands."
"description": "Adds ``--checksum-mode`` and ``--checksum-algorithm`` parameters to high-level ``s3`` commands."
}
2 changes: 1 addition & 1 deletion awscli/customizations/s3/subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ def _raise_if_paths_type_incorrect_for_param(self, param, paths_type, allowed_pa
}
raise ParamValidationError(
f"Expected {param} parameter to be used with one of following path formats: "
f"{', '.join(allowed_paths)} but received {expected_usage_map[paths_type]}"
f"{', '.join([expected_usage_map[path] for path in allowed_paths])}. Instead, received {expected_usage_map[paths_type]}."
)

def _normalize_s3_trailing_slash(self, paths):
Expand Down
12 changes: 8 additions & 4 deletions tests/unit/customizations/s3/test_subcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,29 +412,33 @@ def test_validate_checksum_algorithm_sync_download_error(self):
paths = ['s3://bucket/key', self.file_creator.rootdir]
parameters = {'checksum_algorithm': 'CRC32C'}
cmd_params = CommandParameters('sync', parameters, '')
with self.assertRaises(ParamValidationError):
with self.assertRaises(ParamValidationError) as cm:
cmd_params.add_paths(paths)
self.assertIn('Expected checksum-algorithm parameter to be used with one of following path formats', cm.msg)

def test_validate_checksum_mode_upload_error(self):
paths = [self.file_creator.rootdir, 's3://bucket/key']
parameters = {'checksum_mode': 'ENABLED'}
cmd_params = CommandParameters('cp', parameters, '')
with self.assertRaises(ParamValidationError):
with self.assertRaises(ParamValidationError) as cm:
cmd_params.add_paths(paths)
self.assertIn('Expected checksum-mode parameter to be used with one of following path formats', cm.msg)

def test_validate_checksum_mode_sync_upload_error(self):
paths = [self.file_creator.rootdir, 's3://bucket/key']
parameters = {'checksum_mode': 'ENABLED'}
cmd_params = CommandParameters('sync', parameters, '')
with self.assertRaises(ParamValidationError):
with self.assertRaises(ParamValidationError) as cm:
cmd_params.add_paths(paths)
self.assertIn('Expected checksum-mode parameter to be used with one of following path formats', cm.msg)

def test_validate_checksum_mode_move_error(self):
paths = ['s3://bucket/key', 's3://bucket2/key']
parameters = {'checksum_mode': 'ENABLED'}
cmd_params = CommandParameters('mv', parameters, '')
with self.assertRaises(ParamValidationError):
with self.assertRaises(ParamValidationError) as cm:
cmd_params.add_paths(paths)
self.assertIn('Expected checksum-mode parameter to be used with one of following path formats', cm.msg)

def test_validate_streaming_paths_error(self):
parameters = {'src': '-', 'dest': 's3://bucket'}
Expand Down

0 comments on commit 8eb168d

Please sign in to comment.