def test_s3_post_object_on_presigned_post(self):
    bucket_name = ('test-presigned-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket_name)
    body = 'something body'
    object_key = 'test-presigned-post-key'
    presigned_request = client.generate_presigned_post(Bucket=bucket_name, Key=object_key, ExpiresIn=60)
    files = {'file': body}
    response = requests.post(presigned_request['url'], data=presigned_request['fields'], files=files, verify=False)
    self.assertIn(response.status_code, [200, 204])
    downloaded_object = client.get_object(Bucket=bucket_name, Key=object_key)
    download_object = downloaded_object['Body'].read()
    self.assertEqual(to_str(body), to_str(download_object))
    self._delete_bucket(bucket_name, [object_key])
def test_s3_post_object_on_presigned_post(self):
    bucket_name = ('test-presigned-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket_name)
    body = 'something body'
    object_key = 'test-presigned-post-key'
    presigned_request = client.generate_presigned_post(Bucket=bucket_name, Key=object_key, ExpiresIn=60)
    files = {'file': body}
    response = requests.post(presigned_request['url'], data=presigned_request['fields'], files=files, verify=False)
    self.assertIn(response.status_code, [200, 204])
    downloaded_object = client.get_object(Bucket=bucket_name, Key=object_key)
    download_object = downloaded_object['Body'].read()
    self.assertEqual(to_str(body), to_str(download_object))
    self._delete_bucket(bucket_name, [object_key])