From: Ben Darnell Date: Fri, 18 Jul 2014 03:17:32 +0000 (-0400) Subject: Add test for curl_httpclient ioctl change. X-Git-Tag: v4.1.0b1~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50d2468c32cbba4f5ba29f520bfebdc5ea0ec098;p=thirdparty%2Ftornado.git Add test for curl_httpclient ioctl change. --- diff --git a/tornado/test/httpclient_test.py b/tornado/test/httpclient_test.py index f2f231ac0..70d33fb77 100644 --- a/tornado/test/httpclient_test.py +++ b/tornado/test/httpclient_test.py @@ -37,6 +37,18 @@ class PostHandler(RequestHandler): self.get_argument("arg1"), self.get_argument("arg2"))) +class PutHandler(RequestHandler): + def put(self): + self.write("Put body: ") + self.write(self.request.body) + + +class RedirectHandler(RequestHandler): + def prepare(self): + self.redirect(self.get_argument("url"), + status=int(self.get_argument("status", "302"))) + + class ChunkHandler(RequestHandler): def get(self): self.write("asdf") @@ -97,6 +109,8 @@ class HTTPClientCommonTestCase(AsyncHTTPTestCase): return Application([ url("/hello", HelloWorldHandler), url("/post", PostHandler), + url("/put", PutHandler), + url("/redirect", RedirectHandler), url("/chunk", ChunkHandler), url("/auth", AuthHandler), url("/countdown/([0-9]+)", CountdownHandler, name="countdown"), @@ -396,6 +410,17 @@ Transfer-Encoding: chunked self.assertTrue('must not be empty' in str(context.exception)) + def test_post_307(self): + response = self.fetch("/redirect?status=307&url=/post", + method="POST", body=b"arg1=foo&arg2=bar") + self.assertEqual(response.body, b"Post arg1: foo, arg2: bar") + + def test_put_307(self): + response = self.fetch("/redirect?status=307&url=/put", + method="PUT", body=b"hello") + response.rethrow() + self.assertEqual(response.body, b"Put body: hello") + class RequestProxyTest(unittest.TestCase): def test_request_set(self):