Skip to content

Commit

Permalink
Swap format operation in favor of formatted string syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
aemous committed Sep 23, 2024
1 parent 9515516 commit f2b4cb0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
14 changes: 4 additions & 10 deletions tests/functional/s3/test_cp_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,7 @@ def test_cp_with_error_and_warning_permissions(self):

def test_upload_with_checksum_algorithm_crc32(self):
full_path = self.files.create_file('foo.txt', 'contents')
cmdline = (
'%s %s s3://bucket/key.txt --checksum-algorithm CRC32' % (
self.prefix, full_path))
cmdline = f'{self.prefix} {full_path} s3://bucket/key.txt --checksum-algorithm CRC32'
self.run_cmd(cmdline, expected_rc=0)
self.assert_in_operations_called(
('PutObject', {
Expand All @@ -778,9 +776,7 @@ def test_upload_with_checksum_algorithm_crc32(self):

def test_upload_with_checksum_algorithm_crc32c(self):
full_path = self.files.create_file('foo.txt', 'contents')
cmdline = (
'%s %s s3://bucket/key.txt --checksum-algorithm CRC32C' % (
self.prefix, full_path))
cmdline = f'{self.prefix} {full_path} s3://bucket/key.txt --checksum-algorithm CRC32C'
self.run_cmd(cmdline, expected_rc=0)
self.assert_in_operations_called(
('PutObject', {
Expand All @@ -803,8 +799,7 @@ def test_download_with_checksum_mode_crc32(self):
'Body': BytesIO(b'foo')
}
]
cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \
% (self.prefix, self.files.rootdir)
cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED'
self.run_cmd(cmdline, expected_rc=0)
self.assertEqual(self.operations_called[1][0].name, 'GetObject')
self.assertEqual(self.operations_called[1][1]['ChecksumMode'], 'ENABLED')
Expand All @@ -820,8 +815,7 @@ def test_download_with_checksum_mode_crc32c(self):
'Body': BytesIO(b'foo')
}
]
cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \
% (self.prefix, self.files.rootdir)
cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED'
self.run_cmd(cmdline, expected_rc=0)
self.assertEqual(self.operations_called[1][0].name, 'GetObject')
self.assertEqual(self.operations_called[1][1]['ChecksumMode'], 'ENABLED')
Expand Down
7 changes: 2 additions & 5 deletions tests/functional/s3/test_mv_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ def test_mv_does_not_delete_source_on_failed_put_tagging(self):

def test_upload_with_checksum_algorithm_crc32(self):
full_path = self.files.create_file('foo.txt', 'contents')
cmdline = (
'%s %s s3://bucket/key.txt --checksum-algorithm CRC32' % (
self.prefix, full_path))
cmdline = f'{self.prefix} {full_path} s3://bucket/key.txt --checksum-algorithm CRC32'
self.run_cmd(cmdline, expected_rc=0)
self.assert_in_operations_called(
('PutObject', {
Expand All @@ -272,8 +270,7 @@ def test_download_with_checksum_mode_crc32(self):
},
self.delete_object_response()
]
cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \
% (self.prefix, self.files.rootdir)
cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED'
self.run_cmd(cmdline, expected_rc=0)
self.assertEqual(self.operations_called[1][0].name, 'GetObject')
self.assertEqual(self.operations_called[1][1]['ChecksumMode'], 'ENABLED')
Expand Down
14 changes: 4 additions & 10 deletions tests/functional/s3/test_sync_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,7 @@ def test_with_copy_props(self):

def test_upload_with_checksum_algorithm_sha1(self):
self.files.create_file('foo.txt', 'contents')
cmdline = (
'%s %s s3://bucket/ --checksum-algorithm SHA1' % (
self.prefix, self.files.rootdir))
cmdline = f'{self.prefix} {self.files.rootdir} s3://bucket/ --checksum-algorithm SHA1'
self.run_cmd(cmdline, expected_rc=0)
self.assert_in_operations_called(
('PutObject', {
Expand All @@ -371,9 +369,7 @@ def test_upload_with_checksum_algorithm_sha1(self):

def test_upload_with_checksum_algorithm_sha256(self):
self.files.create_file('foo.txt', 'contents')
cmdline = (
'%s %s s3://bucket/ --checksum-algorithm SHA256' % (
self.prefix, self.files.rootdir))
cmdline = f'{self.prefix} {self.files.rootdir} s3://bucket/ --checksum-algorithm SHA256'
self.run_cmd(cmdline, expected_rc=0)
self.assert_in_operations_called(
('PutObject', {
Expand All @@ -396,8 +392,7 @@ def test_download_with_checksum_mode_sha1(self):
'Body': BytesIO(b'foo')
}
]
cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \
% (self.prefix, self.files.rootdir)
cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED'
self.run_cmd(cmdline, expected_rc=0)
self.assertEqual(self.operations_called[0][0].name, 'ListObjectsV2')

Expand All @@ -412,8 +407,7 @@ def test_download_with_checksum_mode_sha256(self):
'Body': BytesIO(b'foo')
}
]
cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \
% (self.prefix, self.files.rootdir)
cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED'
self.run_cmd(cmdline, expected_rc=0)
self.assertEqual(self.operations_called[0][0].name, 'ListObjectsV2')

Expand Down

0 comments on commit f2b4cb0

Please sign in to comment.