soulsync/tests/test_youtube_channel_settings_ui.py
BoulderBadgeDad f734905ba1 youtube channels: per-channel settings modal UI (cog on the Channels tab)
hover a channel on the watchlist Channels tab -> a settings cog appears (mirror
of the unfollow x) -> opens a self-contained modal:
- Show name (folder): overrides the $channel folder/show-name token; blank uses
  the real channel name.
- 'Force a specific quality' toggle -> resolution/codec/container/60fps/HDR
  override; off = use the global youtube quality from Settings.

VideoYoutube.openChannelSettings(id, title) builds the modal, loads via GET, saves
via POST /youtube/channel/<id>/settings. .vyt-cset-* CSS. string-contract test.

(note: 10 pre-existing soundcloud music-orchestrator test failures are unrelated
to this work — they fail on a clean HEAD too.)
2026-06-25 23:01:35 -07:00

36 lines
1.5 KiB
Python

"""Per-channel settings modal — UI wiring (string-contract level, like the other video-JS
tests). The functional core (storage/API/download wiring) is in test_youtube_channel_settings.
"""
from __future__ import annotations
from pathlib import Path
_ROOT = Path(__file__).resolve().parent.parent
_YT = (_ROOT / "webui" / "static" / "video" / "video-youtube.js").read_text(encoding="utf-8")
_WL = (_ROOT / "webui" / "static" / "video" / "video-watchlist.js").read_text(encoding="utf-8")
_CSS = (_ROOT / "webui" / "static" / "video" / "video-side.css").read_text(encoding="utf-8")
def test_channel_card_has_a_settings_cog():
assert 'data-vyt-wsettings' in _WL # cog button on the watchlist channel card
assert 'vyt-wcard-cog' in _WL and '.vyt-wcard-cog' in _CSS
def test_cog_click_opens_the_settings_modal():
assert 'VideoYoutube.openChannelSettings(' in _WL
assert "cog.getAttribute('data-vyt-wsettings')" in _WL
def test_modal_is_exposed_and_built():
assert 'openChannelSettings: openChannelSettings' in _YT
assert 'function openChannelSettings(' in _YT
assert '.vyt-cset-overlay' in _CSS # modal styles exist
def test_modal_loads_and_saves_via_the_settings_api():
assert "/channel/' + encodeURIComponent(channelId) + '/settings'" in _YT
assert "method: 'POST'" in _YT
# the form carries the custom name + the optional quality override
assert 'data-cset-name' in _YT and 'data-cset-qon' in _YT
assert 'custom_name' in _YT and 'max_resolution' in _YT