From 8e112a6948f02850bf14eb500853eb999809ed9b Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Mon, 13 May 2013 15:35:12 +0200 Subject: [PATCH] test_download_no_Content_Length --- README.rst | 2 +- tests/tests.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 1a5ce694..7555e0c3 100644 --- a/README.rst +++ b/README.rst @@ -979,7 +979,7 @@ Anonymous Sessions ------------------ Instead of a name, you can also directly specify a path to a session file. This -allows for re-using session across multiple hosts: +allows for sessions to be re-used across multiple hosts: .. code-block:: bash diff --git a/tests/tests.py b/tests/tests.py index 6ce631b1..c35eb53f 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -1601,9 +1601,23 @@ class DownloadTest(BaseTestCase): self.assertIn('Done', r.stderr) self.assertEqual(body, r) + def test_download_with_Content_Length(self): + download = Download(output_file=open(os.devnull, 'w')) + download.start(Response( + url=httpbin('/'), + headers={'Content-Length': 10} + )) + time.sleep(1.1) + download._chunk_downloaded(b'12345') + time.sleep(1.1) + download._chunk_downloaded(b'12345') + download.finish() + self.assertFalse(download.interrupted) + def test_download_no_Content_Length(self): download = Download(output_file=open(os.devnull, 'w')) download.start(Response(url=httpbin('/'))) + time.sleep(1.1) download._chunk_downloaded(b'12345') download.finish() self.assertFalse(download.interrupted)