+# coding: utf-8
from __future__ import absolute_import, division, print_function, with_statement
from hashlib import md5
class CurlHTTPClientTestCase(AsyncHTTPTestCase):
def setUp(self):
super(CurlHTTPClientTestCase, self).setUp()
- self.http_client = CurlAsyncHTTPClient(self.io_loop,
- defaults=dict(allow_ipv6=False))
+ self.http_client = self.create_client()
def get_app(self):
return Application([
('/custom_fail_reason', CustomFailReasonHandler),
])
+ def create_client(self, **kwargs):
+ return CurlAsyncHTTPClient(self.io_loop, force_instance=True,
+ defaults=dict(allow_ipv6=False),
+ **kwargs)
+
def test_prepare_curl_callback_stack_context(self):
exc_info = []
response = self.fetch('/custom_fail_reason')
self.assertEqual(str(response.error), "HTTP 400: Custom reason")
+ def test_failed_setup(self):
+ self.http_client = self.create_client(max_clients=1)
+ for i in range(5):
+ response = self.fetch(u'/ユニコード')
+ self.assertIsNot(response.error, None)