-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Subdl Provider: add tests and use standard utils
- Loading branch information
Showing
2 changed files
with
38 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import os | ||
|
||
import pytest | ||
from subliminal_patch.providers.subdl import SubdlProvider | ||
from subliminal_patch.providers.subdl import SubdlSubtitle | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def provider(): | ||
with SubdlProvider(os.environ["SUBDL_TOKEN"]) as provider: | ||
yield provider | ||
|
||
|
||
def test_list_subtitles_movie(provider, movies, languages): | ||
for sub in provider.list_subtitles(movies["dune"], {languages["en"]}): | ||
assert sub.language == languages["en"] | ||
|
||
|
||
def test_download_subtitle(provider, languages): | ||
data = { | ||
"language": languages["en"], | ||
"forced": False, | ||
"hearing_impaired": False, | ||
"page_link": "https://subdl.com/s/info/ebC6BrLCOC", | ||
"download_link": "/subtitle/2808552-2770424.zip", | ||
"file_id": "SUBDL::dune-2021-2770424.zip", | ||
"release_names": ["Dune Part 1 WebDl"], | ||
"uploader": "makoto77", | ||
"season": 0, | ||
"episode": None, | ||
} | ||
|
||
sub = SubdlSubtitle(**data) | ||
provider.download_subtitle(sub) | ||
|
||
assert sub.is_valid() |