def test_s3_upload_fileobj_with_large_file_notification(self):
    bucket_name = ('notif-large-%s' % short_uid())
    (queue_url, queue_attributes) = self._create_test_queue()
    self._create_test_notification_bucket(queue_attributes, bucket_name=bucket_name)
    file_size = 75000000
    large_file = self.generate_large_file(file_size)
    download_file = new_tmp_file()
    try:
        self.s3_client.upload_file(Bucket=bucket_name, Key=large_file.name, Filename=large_file.name)
        self.assertEqual(self._get_test_queue_message_count(queue_url), '1')
        messages = self.sqs_client.receive_message(QueueUrl=queue_url, AttributeNames=['All'])
        message = json.loads(messages['Messages'][0]['Body'])
        self.assertEqual(message['Records'][0]['eventName'], 'ObjectCreated:CompleteMultipartUpload')
        self.s3_client.download_file(Bucket=bucket_name, Key=large_file.name, Filename=download_file)
        self.assertEqual(os.path.getsize(download_file), file_size)
        self.sqs_client.delete_queue(QueueUrl=queue_url)
        self._delete_bucket(bucket_name, large_file.name)
    finally:
        large_file.close()
        rm_rf(large_file.name)
        rm_rf(download_file)
def test_s3_upload_fileobj_with_large_file_notification(self):
    bucket_name = ('notif-large-%s' % short_uid())
    (queue_url, queue_attributes) = self._create_test_queue()
    self._create_test_notification_bucket(queue_attributes, bucket_name=bucket_name)
    file_size = 75000000
    large_file = self.generate_large_file(file_size)
    download_file = new_tmp_file()
    try:
        self.s3_client.upload_file(Bucket=bucket_name, Key=large_file.name, Filename=large_file.name)
        self.assertEqual(self._get_test_queue_message_count(queue_url), '1')
        messages = self.sqs_client.receive_message(QueueUrl=queue_url, AttributeNames=['All'])
        message = json.loads(messages['Messages'][0]['Body'])
        self.assertEqual(message['Records'][0]['eventName'], 'ObjectCreated:CompleteMultipartUpload')
        self.s3_client.download_file(Bucket=bucket_name, Key=large_file.name, Filename=download_file)
        self.assertEqual(os.path.getsize(download_file), file_size)
        self.sqs_client.delete_queue(QueueUrl=queue_url)
        self._delete_bucket(bucket_name, large_file.name)
    finally:
        large_file.close()
        rm_rf(large_file.name)
        rm_rf(download_file)