added ffmpeg resolution test
Browse files- .flake8 +1 -1
- tests/test_cli.py +19 -0
.flake8
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
[flake8]
|
2 |
ignore = E231,E203,W503,Q000,WPS111,WPS305,WPS348,WPS602,D400,DAR201,S101,DAR101,C812,D104,I001,WPS306,WPS214,D401,WPS229,WPS420,WPS230,WPS414,WPS114,WPS226,WPS442,C819,WPS601,T001,RST304,WPS410,WPS428,A003,A002,I003,WPS221,WPS326,WPS201,S405,DAR301,WPS210,WPS202,WPS213,WPS301,P103,WPS407,WPS432,WPS211,S314,S310,S001,IF100,PT001
|
3 |
-
max-line-length =
|
4 |
|
5 |
[isort]
|
|
|
1 |
[flake8]
|
2 |
ignore = E231,E203,W503,Q000,WPS111,WPS305,WPS348,WPS602,D400,DAR201,S101,DAR101,C812,D104,I001,WPS306,WPS214,D401,WPS229,WPS420,WPS230,WPS414,WPS114,WPS226,WPS442,C819,WPS601,T001,RST304,WPS410,WPS428,A003,A002,I003,WPS221,WPS326,WPS201,S405,DAR301,WPS210,WPS202,WPS213,WPS301,P103,WPS407,WPS432,WPS211,S314,S310,S001,IF100,PT001
|
3 |
+
max-line-length = 94
|
4 |
|
5 |
[isort]
|
tests/test_cli.py
CHANGED
@@ -253,6 +253,25 @@ def test_ffmpeg_process_best_should_download(_ffmpeg_downloader, youtube):
|
|
253 |
)
|
254 |
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
@mock.patch("pytube.cli.YouTube.__init__", return_value=None)
|
257 |
def test_download_audio(youtube):
|
258 |
parser = argparse.ArgumentParser()
|
|
|
253 |
)
|
254 |
|
255 |
|
256 |
+
@mock.patch("pytube.cli.YouTube")
|
257 |
+
@mock.patch("pytube.cli._ffmpeg_downloader")
|
258 |
+
def test_ffmpeg_process_res_should_download(_ffmpeg_downloader, youtube):
|
259 |
+
# Given
|
260 |
+
target = "/target"
|
261 |
+
streams = MagicMock()
|
262 |
+
youtube.streams = streams
|
263 |
+
video_stream = MagicMock()
|
264 |
+
streams.filter.return_value.first.return_value = video_stream
|
265 |
+
audio_stream = MagicMock()
|
266 |
+
streams.get_audio_only.return_value = audio_stream
|
267 |
+
# When
|
268 |
+
cli.ffmpeg_process(youtube, "XYZp", target)
|
269 |
+
# Then
|
270 |
+
_ffmpeg_downloader.assert_called_with(
|
271 |
+
audio_stream=audio_stream, video_stream=video_stream, target=target
|
272 |
+
)
|
273 |
+
|
274 |
+
|
275 |
@mock.patch("pytube.cli.YouTube.__init__", return_value=None)
|
276 |
def test_download_audio(youtube):
|
277 |
parser = argparse.ArgumentParser()
|