diff --git a/tests/integration/plugins/conftest.py b/tests/integration/plugins/conftest.py index 2426bfa4e..48ac4a3ff 100644 --- a/tests/integration/plugins/conftest.py +++ b/tests/integration/plugins/conftest.py @@ -9,12 +9,13 @@ @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 - diff --git a/tests/integration/plugins/test_chapters.py b/tests/integration/plugins/test_chapters.py index 209de1376..c0d80ca25 100644 --- a/tests/integration/plugins/test_chapters.py +++ b/tests/integration/plugins/test_chapters.py @@ -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 @@ def test_chapters_from_comments( ) 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)