]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add tests
authordano <oreilldf@gmail.com>
Sun, 11 May 2014 02:27:40 +0000 (22:27 -0400)
committerdano <oreilldf@gmail.com>
Sun, 11 May 2014 02:27:40 +0000 (22:27 -0400)
tornado/test/curl_httpclient_test.py

index fb6965648ecb958adfe945e722929bffb98dcc10..6a592701a3262641b15b887dffbaef63c460ff71 100644 (file)
@@ -67,6 +67,9 @@ class DigestAuthHandler(RequestHandler):
                             'Digest realm="%s", nonce="%s", opaque="%s"' %
                             (realm, nonce, opaque))
 
+class CustomReasonHandler(RequestHandler):
+    def get(self):
+        self.set_status(200, "Custom reason")
 
 @unittest.skipIf(pycurl is None, "pycurl module not present")
 class CurlHTTPClientTestCase(AsyncHTTPTestCase):
@@ -78,6 +81,7 @@ class CurlHTTPClientTestCase(AsyncHTTPTestCase):
     def get_app(self):
         return Application([
             ('/digest', DigestAuthHandler),
+            ('/custom_reason', CustomReasonHandler),
         ])
 
     def test_prepare_curl_callback_stack_context(self):
@@ -100,3 +104,7 @@ class CurlHTTPClientTestCase(AsyncHTTPTestCase):
         response = self.fetch('/digest', auth_mode='digest',
                               auth_username='foo', auth_password='bar')
         self.assertEqual(response.body, b'ok')
+
+    def test_custom_reason(self):
+        response = self.fetch('/custom_reason')
+        self.assertEqual(response.reason, "Custom reason")