mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186)
Re-enable test_issue16464() of test_urllib2, move it to urllib2_localnet and use the local HTTP server rather than an external HTTP server.
This commit is contained in:
parent
59e004af63
commit
8e98175a03
2 changed files with 18 additions and 18 deletions
|
@ -660,6 +660,24 @@ class TestUrlopen(unittest.TestCase):
|
|||
(index, len(lines[index]), len(line)))
|
||||
self.assertEqual(index + 1, len(lines))
|
||||
|
||||
def test_issue16464(self):
|
||||
# See https://bugs.python.org/issue16464
|
||||
# and https://bugs.python.org/issue46648
|
||||
handler = self.start_server([
|
||||
(200, [], b'any'),
|
||||
(200, [], b'any'),
|
||||
])
|
||||
opener = urllib.request.build_opener()
|
||||
request = urllib.request.Request("http://localhost:%s" % handler.port)
|
||||
self.assertEqual(None, request.data)
|
||||
|
||||
opener.open(request, "1".encode("us-ascii"))
|
||||
self.assertEqual(b"1", request.data)
|
||||
self.assertEqual("1", request.get_header("Content-length"))
|
||||
|
||||
opener.open(request, "1234567890".encode("us-ascii"))
|
||||
self.assertEqual(b"1234567890", request.data)
|
||||
self.assertEqual("10", request.get_header("Content-length"))
|
||||
|
||||
def setUpModule():
|
||||
thread_info = threading_helper.threading_setup()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue