From 0a97f59125ea1c944869b9a32cf954a9c41bc53e Mon Sep 17 00:00:00 2001 From: James Saryerwinnie Date: Wed, 26 Mar 2014 16:11:36 -0700 Subject: [PATCH 1/2] Use unicode escape sequence for file type --- tests/integration/customizations/s3/test_plugin.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/integration/customizations/s3/test_plugin.py b/tests/integration/customizations/s3/test_plugin.py index 48e286cb02da..e53b8c608e38 100644 --- a/tests/integration/customizations/s3/test_plugin.py +++ b/tests/integration/customizations/s3/test_plugin.py @@ -808,5 +808,13 @@ def test_s3_filtering(self): self.assertNotIn(p.stdout, 'foo.txt') +class TestFileWithSpaces(BaseS3CLICommand): + def test_upload_download_file_with_spaces(self): + pass + + def test_sync_file_with_spaces(self): + bucket_name = self.create_bucket() + + if __name__ == "__main__": unittest.main() From 85ab4352b17bf84a86ac105c328e54f2fb43e86e Mon Sep 17 00:00:00 2001 From: James Saryerwinnie Date: Wed, 26 Mar 2014 17:47:43 -0700 Subject: [PATCH 2/2] Add integ tests for #718 The root cause was in botocore which has its own tests, but this verifies that we can upload/download/sync files with spaces as expected. Depends on boto/botocore#264. --- .../customizations/s3/test_plugin.py | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/integration/customizations/s3/test_plugin.py b/tests/integration/customizations/s3/test_plugin.py index e53b8c608e38..4798f46d56b4 100644 --- a/tests/integration/customizations/s3/test_plugin.py +++ b/tests/integration/customizations/s3/test_plugin.py @@ -810,10 +810,32 @@ def test_s3_filtering(self): class TestFileWithSpaces(BaseS3CLICommand): def test_upload_download_file_with_spaces(self): - pass + bucket_name = self.create_bucket() + filename = self.files.create_file('with space.txt', 'contents') + p = aws('s3 cp %s s3://%s/ --recursive' % (self.files.rootdir, + bucket_name)) + self.assert_no_errors(p) + os.remove(filename) + # Now download the file back down locally. + p = aws('s3 cp s3://%s/ %s --recursive' % (bucket_name, + self.files.rootdir)) + self.assert_no_errors(p) + self.assertEqual(os.listdir(self.files.rootdir)[0], 'with space.txt') def test_sync_file_with_spaces(self): bucket_name = self.create_bucket() + bucket_name = self.create_bucket() + filename = self.files.create_file('with space.txt', 'contents') + p = aws('s3 sync %s s3://%s/' % (self.files.rootdir, + bucket_name)) + self.assert_no_errors(p) + # Now syncing again should *not* trigger any uploads (i.e we should + # get nothing on stdout). + p2 = aws('s3 sync %s s3://%s/' % (self.files.rootdir, + bucket_name)) + self.assertEqual(p2.stdout, '') + self.assertEqual(p2.stderr, '') + self.assertEqual(p2.rc, 0) if __name__ == "__main__":