lint
This commit is contained in:
parent
46029c7c94
commit
ddcd06713a
2 changed files with 43 additions and 34 deletions
|
|
@ -9,12 +9,13 @@ from ytdl_sub.utils.chapters import Chapters
|
|||
@pytest.fixture
|
||||
def mock_chapters_class():
|
||||
with patch.object(Chapters, "from_empty") as mock_chapters:
|
||||
mock_chapters.return_value = Chapters.from_string("""
|
||||
mock_chapters.return_value = Chapters.from_string(
|
||||
"""
|
||||
"0:00 Intro\n",
|
||||
"00:07 Part 1\n",
|
||||
"0:13 Part 2\n",
|
||||
"00:19 Part 3\n",
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
yield
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
from typing import Dict
|
||||
|
||||
import pytest
|
||||
from mergedeep import mergedeep
|
||||
|
||||
from expected_download import assert_expected_downloads
|
||||
from expected_transaction_log import assert_transaction_log_matches
|
||||
from integration.plugins.conftest import mock_chapters_class
|
||||
from mergedeep import mergedeep
|
||||
|
||||
from ytdl_sub.entries.entry import ytdl_sub_chapters_from_comments
|
||||
from ytdl_sub.subscriptions.subscription import Subscription
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def chapters_base_subscription_dict(output_directory) -> Dict:
|
||||
return {
|
||||
|
|
@ -21,42 +22,51 @@ def chapters_base_subscription_dict(output_directory) -> Dict:
|
|||
},
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sponsorblock_disabled_dict(chapters_base_subscription_dict) -> Dict:
|
||||
mergedeep.merge(chapters_base_subscription_dict, {
|
||||
"chapters": {
|
||||
"enable": "{enable_sponsorblock}",
|
||||
"sponsorblock_categories": [
|
||||
"outro",
|
||||
"selfpromo",
|
||||
"preview",
|
||||
"interaction",
|
||||
"sponsor",
|
||||
"music_offtopic",
|
||||
"intro",
|
||||
],
|
||||
"remove_sponsorblock_categories": "all",
|
||||
"remove_chapters_regex": [
|
||||
"Intro",
|
||||
"Outro",
|
||||
],
|
||||
mergedeep.merge(
|
||||
chapters_base_subscription_dict,
|
||||
{
|
||||
"chapters": {
|
||||
"enable": "{enable_sponsorblock}",
|
||||
"sponsorblock_categories": [
|
||||
"outro",
|
||||
"selfpromo",
|
||||
"preview",
|
||||
"interaction",
|
||||
"sponsor",
|
||||
"music_offtopic",
|
||||
"intro",
|
||||
],
|
||||
"remove_sponsorblock_categories": "all",
|
||||
"remove_chapters_regex": [
|
||||
"Intro",
|
||||
"Outro",
|
||||
],
|
||||
},
|
||||
"overrides": {
|
||||
"enable_sponsorblock": "False",
|
||||
},
|
||||
},
|
||||
"overrides": {
|
||||
"enable_sponsorblock": "False",
|
||||
},
|
||||
})
|
||||
)
|
||||
return chapters_base_subscription_dict
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def chapters_from_comments_subscription_dict(chapters_base_subscription_dict) -> Dict:
|
||||
mergedeep.merge(chapters_base_subscription_dict, {
|
||||
"chapters": {
|
||||
"embed_chapters": True,
|
||||
"allow_chapters_from_comments": True,
|
||||
mergedeep.merge(
|
||||
chapters_base_subscription_dict,
|
||||
{
|
||||
"chapters": {
|
||||
"embed_chapters": True,
|
||||
"allow_chapters_from_comments": True,
|
||||
},
|
||||
},
|
||||
})
|
||||
)
|
||||
return chapters_base_subscription_dict
|
||||
|
||||
|
||||
class TestChapters:
|
||||
def test_chapters_disabled_respected(
|
||||
self,
|
||||
|
|
@ -98,9 +108,7 @@ class TestChapters:
|
|||
)
|
||||
|
||||
with mock_download_collection_entries(
|
||||
is_youtube_channel=False,
|
||||
num_urls=1,
|
||||
is_dry_run=dry_run
|
||||
is_youtube_channel=False, num_urls=1, is_dry_run=dry_run
|
||||
):
|
||||
transaction_log = subscription.download(dry_run=dry_run)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue