def test_s3_presigned_post_expires(self):
    bucket_name = ('test-bucket-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket_name)
    object_key = 'test-presigned-post-key'
    presigned_request = client.generate_presigned_post(Bucket=bucket_name, Key=object_key, ExpiresIn=2)
    time.sleep(3)
    files = {'file': 'file content'}
    response = requests.post(presigned_request['url'], data=presigned_request['fields'], files=files, verify=False)
    self.assertEqual(response.status_code, 400)
    self.assertTrue(('ExpiredToken' in response.text))
    self._delete_bucket(bucket_name)
def test_s3_presigned_post_expires(self):
    bucket_name = ('test-bucket-%s' % short_uid())
    client = self._get_test_client()
    client.create_bucket(Bucket=bucket_name)
    object_key = 'test-presigned-post-key'
    presigned_request = client.generate_presigned_post(Bucket=bucket_name, Key=object_key, ExpiresIn=2)
    time.sleep(3)
    files = {'file': 'file content'}
    response = requests.post(presigned_request['url'], data=presigned_request['fields'], files=files, verify=False)
    self.assertEqual(response.status_code, 400)
    self.assertTrue(('ExpiredToken' in response.text))
    self._delete_bucket(bucket_name)