fix prebuilt tests
This commit is contained in:
parent
ad7ed4cb3b
commit
f7837c69ea
1 changed files with 75 additions and 76 deletions
|
|
@ -4,6 +4,7 @@ import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
from typing import List
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
@ -126,7 +127,11 @@ def mock_download_collection_entries(
|
||||||
def _(**kwargs):
|
def _(**kwargs):
|
||||||
return mock_entry_dict_factory(**kwargs)
|
return mock_entry_dict_factory(**kwargs)
|
||||||
|
|
||||||
collection_1_entry_dicts = [
|
def _write_entries_to_working_dir(*args, **kwargs) -> List[Dict]:
|
||||||
|
if (len(args[0].collection.urls.list) == 1) or (
|
||||||
|
"season.2" in kwargs["url"] and len(args[0].download_options.urls.list) > 1
|
||||||
|
):
|
||||||
|
return [
|
||||||
_(
|
_(
|
||||||
uid="21-1",
|
uid="21-1",
|
||||||
upload_date="20210808",
|
upload_date="20210808",
|
||||||
|
|
@ -156,7 +161,7 @@ def mock_download_collection_entries(
|
||||||
is_youtube_channel=is_youtube_channel,
|
is_youtube_channel=is_youtube_channel,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
collection_2_entry_dicts = [
|
return [
|
||||||
# 20-3 should resolve to collection 1 (which is season 2)
|
# 20-3 should resolve to collection 1 (which is season 2)
|
||||||
_(
|
_(
|
||||||
uid="20-3",
|
uid="20-3",
|
||||||
|
|
@ -196,15 +201,9 @@ def mock_download_collection_entries(
|
||||||
]
|
]
|
||||||
|
|
||||||
with patch.object(
|
with patch.object(
|
||||||
Downloader, "extract_info_via_info_json"
|
Downloader, "extract_info_via_info_json", new=_write_entries_to_working_dir
|
||||||
) as mock_download_metadata, patch.object(
|
), patch.object(Downloader, "_extract_entry_info_with_retry", new=lambda _, entry: entry):
|
||||||
Downloader, "_extract_entry_info_with_retry", new=lambda _, entry: entry
|
|
||||||
):
|
|
||||||
# Stub out metadata. TODO: update this if we do metadata plugins
|
# Stub out metadata. TODO: update this if we do metadata plugins
|
||||||
mock_download_metadata.side_effect = [
|
|
||||||
collection_1_entry_dicts,
|
|
||||||
collection_2_entry_dicts,
|
|
||||||
]
|
|
||||||
yield
|
yield
|
||||||
|
|
||||||
return _mock_download_collection_entries_factory
|
return _mock_download_collection_entries_factory
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue