]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add testcase for finish method of RequestHandler
authorluojiebin <luo.jiebin@qq.com>
Fri, 15 Dec 2017 17:11:19 +0000 (01:11 +0800)
committerBen Darnell <ben@bendarnell.com>
Sun, 20 May 2018 00:46:02 +0000 (20:46 -0400)
tornado/test/web_test.py

index 45072aac35eba114c0db70222c9fbfab7be9e349..7d8d069a35ea01b58838d8fbe3daca23abd154f9 100644 (file)
@@ -191,6 +191,21 @@ class SecureCookieV2Test(unittest.TestCase):
         self.assertEqual(new_handler.get_secure_cookie('foo'), None)
 
 
+class FinishTest(WebTestCase):
+    def get_handlers(self):
+        class FinishHandler(RequestHandler):
+            def get(self):
+                self.write("The finish method should return Future.")
+                f = self.finish()
+                assert isinstance(f, Future)
+
+        return [("/finish", FinishHandler)]
+
+    def test_finish_method_return_future(self):
+        response = self.fetch(self.get_url('/finish'))
+        self.assertEqual(response.code, 200)
+
+
 class CookieTest(WebTestCase):
     def get_handlers(self):
         class SetCookieHandler(RequestHandler):