def test_upload_from_stream(self): s3.initialize() s3_path = 'test-directory/test_002_upload_from_stream.txt' s3.upload_from_stream(s3_path, StringIO(self.content), self.content_type) self._validate_and_remove_upload(s3_path)
def test_upload_from_stream(self): s3.initialize() s3_path = 'test-directory/test_002_upload_from_stream.txt' s3.upload_from_stream( s3_path, StringIO(self.content), self.content_type ) self._validate_and_remove_upload( s3_path )
def test_upload_from_file(self): s3.initialize() s3_path = 'test-directory/test_002_upload_from_file.txt' file_descriptor, local_path = tempfile.mkstemp(suffix='.txt') try: try: os.write(file_descriptor, self.content) finally: os.close(file_descriptor) s3.upload_from_file(s3_path, local_path, self.content_type) finally: os.remove(local_path) self._validate_and_remove_upload(s3_path)
def test_upload_from_file(self): s3.initialize() s3_path = 'test-directory/test_002_upload_from_file.txt' file_descriptor, local_path = tempfile.mkstemp(suffix='.txt') try: try: os.write(file_descriptor, self.content) finally: os.close(file_descriptor) s3.upload_from_file( s3_path, local_path, self.content_type) finally: os.remove(local_path) self._validate_and_remove_upload( s3_path )
def initialize_infrastructure(): """ Initialize the AWS infrastructure used by donomo archive. """ s3.initialize() sqs.initialize()