mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-09-19 21:12:20 +03:00
Refactor test configurations and enhance testing framework
- Replace TempConfig with DummyConfig across tests for consistency - Introduce unit tests workflow configuration - Add pytest configuration for standardized test discovery - Implement comprehensive tests for config loading and downloader behavior - Clean up unused temp_config.py and related references
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import json
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from ytplaylist.config import ConfigLoader
|
||||
|
||||
|
||||
def test_config_loader_reads_properties(tmp_path, monkeypatch):
|
||||
# create a minimal config file with known binary names that exist on PATH
|
||||
cfg = {
|
||||
"playlists": [{"url": "https://www.youtube.com/playlist?list=FAKE", "save_path": "./tmp", "archive": "archive.txt"}],
|
||||
"yt_dlp_path": "python",
|
||||
"ffmpeg_path": "python",
|
||||
"aria2c_path": "python",
|
||||
"max_parallel_downloads": 3,
|
||||
"aria2c_connections": 2,
|
||||
}
|
||||
|
||||
p = tmp_path / "yt-playlist-config.json"
|
||||
p.write_text(json.dumps(cfg), encoding="utf-8")
|
||||
|
||||
# Use absolute path so ConfigLoader doesn't try to create ./config
|
||||
loader = ConfigLoader(str(p))
|
||||
|
||||
assert loader.playlists == cfg["playlists"]
|
||||
assert loader.yt_dlp_path == "python"
|
||||
assert loader.ffmpeg_path == "python"
|
||||
assert loader.aria2c_path == "python"
|
||||
assert loader.max_parallel_downloads == 3
|
||||
assert loader.aria2c_connections == 2
|
||||
Reference in New Issue
Block a user