Example #1
0
 def setUp(self):
     self.session = botocore.session.get_session(EnvironmentVariables)
     self.client = self.session.create_client('s3', 'us-west-2')
     self.source_client = self.session.create_client('s3', 'us-west-2')
     params = {'region': 'us-west-2'}
     self.s3_handler = S3Handler(self.session, params)
     self.bucket = make_s3_files(self.session)
     self.file_creator = FileCreator()
     self.loc_files = make_loc_files(self.file_creator)
Example #2
0
 def setUp(self):
     self.session = botocore.session.get_session(EnvironmentVariables)
     self.client = self.session.create_client('s3', 'us-west-2')
     self.source_client = self.session.create_client('s3', 'us-west-2')
     params = {'region': 'us-west-2'}
     self.s3_handler = S3Handler(self.session, params)
     self.bucket = make_s3_files(self.session)
     self.file_creator = FileCreator()
     self.loc_files = make_loc_files(self.file_creator)
Example #3
0
 def setUp(self):
     self.session = botocore.session.get_session(EnvironmentVariables)
     self.client = self.session.create_client('s3', 'us-west-2')
     self.source_client = self.session.create_client('s3', 'us-west-2')
     params = {'region': 'us-west-2', 'acl': ['private'], 'quiet': True}
     self.s3_handler = S3Handler(self.session, params)
     self.bucket = make_s3_files(self.session, key1=u'\u2713')
     self.bucket2 = create_bucket(self.session)
     self.s3_files = [self.bucket + '/' + u'\u2713']
     self.s3_files2 = [self.bucket2 + '/' + u'\u2713']
 def setUp(self):
     self.session = botocore.session.get_session()
     # Use the datetime and and blob parsing of the CLI
     factory = self.session.get_component('response_parser_factory')
     factory.set_parser_defaults(blob_parser=lambda x: x,
                                 timestamp_parser=lambda x: x)
     self.client = self.session.create_client('s3', region_name='us-west-2')
     self.bucket = make_s3_files(self.session)
     self.file1 = self.bucket + '/' + 'text1.txt'
     self.file2 = self.bucket + '/' + 'another_directory/text2.txt'
Example #5
0
 def setUp(self):
     self.session = botocore.session.get_session(EnvironmentVariables)
     self.client = self.session.create_client('s3', 'us-west-2')
     self.source_client = self.session.create_client('s3', 'us-west-2')
     params = {'region': 'us-west-2', 'acl': ['private'], 'quiet': True}
     self.s3_handler = S3Handler(self.session, params)
     self.bucket = make_s3_files(self.session, key1=u'\u2713')
     self.bucket2 = create_bucket(self.session)
     self.s3_files = [self.bucket + '/' + u'\u2713']
     self.s3_files2 = [self.bucket2 + '/' + u'\u2713']
Example #6
0
 def setUp(self):
     self.session = botocore.session.get_session(EnvironmentVariables)
     # Use the datetime and and blob parsing of the CLI
     factory = self.session.get_component('response_parser_factory')
     factory.set_parser_defaults(
         blob_parser=lambda x: x,
         timestamp_parser=lambda x: x)
     self.client = self.session.create_client('s3', region_name='us-west-2')
     self.bucket = make_s3_files(self.session)
     self.file1 = self.bucket + '/' + 'text1.txt'
     self.file2 = self.bucket + '/' + 'another_directory/text2.txt'
Example #7
0
 def setUp(self):
     self.session = botocore.session.get_session(EnvironmentVariables)
     self.client = self.session.create_client('s3', 'us-west-2')
     self.source_client = self.session.create_client('s3', 'us-west-2')
     params = {'region': 'us-west-2', 'acl': ['private']}
     self.s3_handler = S3Handler(self.session, params)
     self.bucket = make_s3_files(self.session)
     self.bucket2 = create_bucket(self.session)
     self.s3_files = [self.bucket + '/text1.txt',
                      self.bucket + '/another_directory/text2.txt']
     self.s3_files2 = [self.bucket2 + '/text1.txt',
                       self.bucket2 + '/another_directory/text2.txt']
Example #8
0
 def setUp(self):
     self.session = botocore.session.get_session(EnvironmentVariables)
     self.client = self.session.create_client('s3', 'us-west-2')
     self.source_client = self.session.create_client('s3', 'us-west-2')
     params = {'region': 'us-west-2', 'acl': 'private'}
     self.s3_handler = S3Handler(self.session, params)
     self.bucket = make_s3_files(self.session)
     self.bucket2 = create_bucket(self.session)
     self.s3_files = [self.bucket + '/text1.txt',
                      self.bucket + '/another_directory/text2.txt']
     self.s3_files2 = [self.bucket2 + '/text1.txt',
                       self.bucket2 + '/another_directory/text2.txt']
Example #9
0
 def test_delete_url_encode(self):
     bucket = make_s3_files(self.session, key1='a+b/foo', key2=None)
     self.addCleanup(s3_cleanup, bucket, self.session)
     key = bucket + '/a+b/foo'
     tasks = [FileInfo(
         src=key, src_type='s3',
         dest_type='local', operation_name='delete', size=0,
         client=self.client, source_client=self.source_client
     )]
     response = self.client.list_objects(Bucket=bucket)
     self.assertEqual(len(response.get('Contents', [])), 1)
     self.s3_handler.call(tasks)
     response = self.client.list_objects(Bucket=bucket)
     self.assertEqual(len(response.get('Contents', [])), 0)
Example #10
0
 def test_delete_url_encode(self):
     bucket = make_s3_files(self.session, key1='a+b/foo', key2=None)
     self.addCleanup(s3_cleanup, bucket, self.session)
     key = bucket + '/a+b/foo'
     tasks = [FileInfo(
         src=key, src_type='s3',
         dest_type='local', operation_name='delete', size=0,
         client=self.client, source_client=self.source_client
     )]
     response = self.client.list_objects(Bucket=bucket)
     self.assertEqual(len(response.get('Contents', [])), 1)
     self.s3_handler.call(tasks)
     response = self.client.list_objects(Bucket=bucket)
     self.assertEqual(len(response.get('Contents', [])), 0)
Example #11
0
 def setUp(self):
     self.session = botocore.session.get_session(EnvironmentVariables)
     self.client = self.session.create_client('s3', 'us-west-2')
     params = {'region': 'us-west-2'}
     self.s3_handler = S3Handler(self.session, params)
     self.s3_handler_multi = S3Handler(
         self.session, params,
         runtime_config=runtime_config(multipart_threshold=10,
                                       multipart_chunksize=2))
     self.bucket = make_s3_files(self.session)
     self.s3_files = [self.bucket + '/text1.txt',
                      self.bucket + '/another_directory/text2.txt']
     self.file_creator = FileCreator()
     directory1 = self.file_creator.rootdir + os.sep + 'some_directory' + \
         os.sep
     filename1 = directory1 + "text1.txt"
     directory2 = directory1 + 'another_directory' + os.sep
     filename2 = directory2 + "text2.txt"
     self.loc_files = [filename1, filename2]
Example #12
0
 def setUp(self):
     self.session = botocore.session.get_session(EnvironmentVariables)
     self.client = self.session.create_client('s3', 'us-west-2')
     params = {'region': 'us-west-2'}
     self.s3_handler = S3Handler(self.session, params)
     self.s3_handler_multi = S3Handler(
         self.session, params,
         runtime_config=runtime_config(multipart_threshold=10,
                                       multipart_chunksize=2))
     self.bucket = make_s3_files(self.session)
     self.s3_files = [self.bucket + '/text1.txt',
                      self.bucket + '/another_directory/text2.txt']
     self.file_creator = FileCreator()
     directory1 = self.file_creator.rootdir + os.sep + 'some_directory' + \
         os.sep
     filename1 = directory1 + "text1.txt"
     directory2 = directory1 + 'another_directory' + os.sep
     filename2 = directory2 + "text2.txt"
     self.loc_files = [filename1, filename2]