Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbannon committed Oct 4, 2024
1 parent 46029c7 commit ddcd067
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 34 deletions.
7 changes: 4 additions & 3 deletions tests/integration/plugins/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

70 changes: 39 additions & 31 deletions tests/integration/plugins/test_chapters.py
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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,
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit ddcd067

Please sign in to comment.