#NEWLINE# def test_can_put_to_generated_signed_url( self ) : #NEWLINE# #INDENT# import os , tempfile , requests , uuid #NEWLINE# from drf_to_s3 import s3 #NEWLINE# from django.conf import settings #NEWLINE# self . new_key = ( '%s/%s' % ( 'nobody@bodylabs.com' , str ( uuid . uuid4 ( ) ) ) ) #NEWLINE# aws_access_id = os . environ [ 'AWS_ACCESS_KEY_ID' ] #NEWLINE# secret_key = os . environ [ 'AWS_SECRET_ACCESS_KEY' ] #NEWLINE# signed_url = s3 . build_signed_upload_uri ( bucket = signed_url . bucket_name , key = self . new_key , access_key_id = aws_access_id , secret_key = secret_key , expire_after_seconds = 60 ) #NEWLINE# with tempfile . NamedTemporaryFile ( ) as f : #NEWLINE# #INDENT# f . write ( os . urandom ( 1024 ) ) #NEWLINE# resp = requests . put ( signed_url , data = f . read ( ) ) #NEWLINE# self . assertEquals ( resp . status_code , 200 )