stream test
Browse files- tests/test_request.py +2 -2
tests/test_request.py
CHANGED
@@ -7,9 +7,8 @@ import pytest
|
|
7 |
from pytube import request
|
8 |
|
9 |
|
10 |
-
@mock.patch("pytube.request.filesize", return_value=3 * 8 * 1024)
|
11 |
@mock.patch("pytube.request.urlopen")
|
12 |
-
def test_streaming(mock_urlopen
|
13 |
# Given
|
14 |
fake_stream_binary = [
|
15 |
os.urandom(8 * 1024),
|
@@ -19,6 +18,7 @@ def test_streaming(mock_urlopen, filesize):
|
|
19 |
]
|
20 |
response = mock.Mock()
|
21 |
response.read.side_effect = fake_stream_binary
|
|
|
22 |
mock_urlopen.return_value = response
|
23 |
# When
|
24 |
response = request.stream("http://fakeassurl.gov")
|
|
|
7 |
from pytube import request
|
8 |
|
9 |
|
|
|
10 |
@mock.patch("pytube.request.urlopen")
|
11 |
+
def test_streaming(mock_urlopen):
|
12 |
# Given
|
13 |
fake_stream_binary = [
|
14 |
os.urandom(8 * 1024),
|
|
|
18 |
]
|
19 |
response = mock.Mock()
|
20 |
response.read.side_effect = fake_stream_binary
|
21 |
+
response.info.return_value = {"Content-Range": "bytes 200-1000/24576"}
|
22 |
mock_urlopen.return_value = response
|
23 |
# When
|
24 |
response = request.stream("http://fakeassurl.gov")
|