class CurlHTTPClientTestCase(AsyncHTTPTestCase): def setUp(self): super(CurlHTTPClientTestCase, self).setUp() self.http_client = CurlAsyncHTTPClient(self.io_loop, defaults=dict(allow_ipv6=False)) def get_app(self): return Application([ ('/digest', DigestAuthHandler), ]) def test_prepare_curl_callback_stack_context(self): exc_info = [] def error_handler(typ, value, tb): exc_info.append((typ, value, tb)) self.stop() return True with ExceptionStackContext(error_handler): request = HTTPRequest(self.get_url('/'), prepare_curl_callback=lambda curl: 1 / 0) self.http_client.fetch(request, callback=self.stop) self.wait() self.assertEqual(1, len(exc_info)) self.assertIs(exc_info[0][0], ZeroDivisionError) def test_digest_auth(self): response = self.fetch('/digest', auth_mode='digest', auth_username='******', auth_password='******') self.assertEqual(response.body, b'ok')
def setUp(self): super(CurlHTTPClientTestCase, self).setUp() self.http_client = CurlAsyncHTTPClient(self.io_loop, defaults=dict(allow_ipv6=False))