This repository has been archived by the owner on Oct 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b4ecc8
commit cb1eb41
Showing
10 changed files
with
62 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# standard imports | ||
import os | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# lib imports | ||
import pytest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# local imports | ||
import Code | ||
from Code import ValidatePrefs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# standard imports | ||
import os | ||
import shutil | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# standard imports | ||
import time | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# lib imports | ||
import pytest | ||
|
||
# local imports | ||
from Code import youtube_dl_helper | ||
|
||
|
||
def test_process_youtube(): | ||
@pytest.mark.parametrize('url', [ | ||
'https://www.youtube.com/watch?v=dQw4w9WgXcQ', | ||
'https://www.youtube.com/watch?v=Wb8j8Ojd4YQ&list=PLMYr5_xSeuXAbhxYHz86hA1eCDugoxXY0&pp=iAQB', # playlist test | ||
]) | ||
def test_process_youtube(url): | ||
# test valid urls | ||
valid_urls = [ | ||
'https://www.youtube.com/watch?v=dQw4w9WgXcQ', | ||
'https://www.youtube.com/watch?v=Wb8j8Ojd4YQ&list=PLMYr5_xSeuXAbhxYHz86hA1eCDugoxXY0&pp=iAQB', # playlist test | ||
] | ||
for url in valid_urls: | ||
audio_url = youtube_dl_helper.process_youtube(url=url) | ||
assert audio_url is not None | ||
assert audio_url.startswith('https://') | ||
audio_url = youtube_dl_helper.process_youtube(url=url) | ||
assert audio_url is not None | ||
assert audio_url.startswith('https://') | ||
|
||
|
||
def test_process_youtube_invalid(): | ||
@pytest.mark.parametrize('url', [ | ||
'https://www.youtube.com/watch?v=notavideoid', | ||
'https://blahblahblah', | ||
]) | ||
def test_process_youtube_invalid(url): | ||
# test invalid urls | ||
invalid_urls = [ | ||
'https://www.youtube.com/watch?v=notavideoid', | ||
'https://blahblahblah', | ||
] | ||
for url in invalid_urls: | ||
audio_url = youtube_dl_helper.process_youtube(url=url) | ||
assert audio_url is None | ||
audio_url = youtube_dl_helper.process_youtube(url=url) | ||
assert audio_url is None |