test_download_no_Content_Length

This commit is contained in:
Jakub Roztocil 2013-05-13 15:35:12 +02:00
parent 87c59ae561
commit 8e112a6948
2 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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)