def test_s3_presigned_post_success_action_status_201_response(self):
    bucket_name = ('test-presigned-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket_name)
    body = 'something body'
    object_key = 'key-${filename}'
    presigned_request = client.generate_presigned_post(Bucket=bucket_name, Key=object_key, Fields={'success_action_status': 201}, ExpiresIn=60)
    files = {'file': ('my-file', body)}
    response = requests.post(presigned_request['url'], data=presigned_request['fields'], files=files, verify=False)
    expected_response_content = '\n                <PostResponse>\n                    <Location>{location}</Location>\n                    <Bucket>{bucket}</Bucket>\n                    <Key>{key}</Key>\n                    <ETag>{etag}</ETag>\n                </PostResponse>\n                '.format(location='http://localhost/key-my-file', bucket=bucket_name, key='key-my-file', etag='EXAMPLE_KEY')
    self.assertEqual(response.status_code, 201)
    self.assertEqual(response.text, expected_response_content)
    self._delete_bucket(bucket_name, ['key-my-file'])
def test_s3_presigned_post_success_action_status_201_response(self):
    bucket_name = ('test-presigned-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket_name)
    body = 'something body'
    object_key = 'key-${filename}'
    presigned_request = client.generate_presigned_post(Bucket=bucket_name, Key=object_key, Fields={'success_action_status': 201}, ExpiresIn=60)
    files = {'file': ('my-file', body)}
    response = requests.post(presigned_request['url'], data=presigned_request['fields'], files=files, verify=False)
    expected_response_content = '\n                <PostResponse>\n                    <Location>{location}</Location>\n                    <Bucket>{bucket}</Bucket>\n                    <Key>{key}</Key>\n                    <ETag>{etag}</ETag>\n                </PostResponse>\n                '.format(location='http://localhost/key-my-file', bucket=bucket_name, key='key-my-file', etag='EXAMPLE_KEY')
    self.assertEqual(response.status_code, 201)
    self.assertEqual(response.text, expected_response_content)
    self._delete_bucket(bucket_name, ['key-my-file'])