refactor: rework configuration models, add CLI, tests and VSCode settings
- Replace hardcoded CONFIG_PATH with appdirs AppDirs (use app.user_config_dir) and update SETTINGS_PATH - Rework dataclasses: add Library, QbitTorrent; convert Komga.libraries to List[Library]; use Path for media_path; add getLibraryByName and proper __post_init__ conversions - Extend KomGrabber to support downloader/downloader_settings (aria2/qbit), normalize Path handling and expanduser usage - Add type fixes, utility methods (getattr/_setattr) and API __post_init__ to convert nested dicts to dataclass instances - Add package CLI entrypoints (__main__.py, src package main) and simple runner (main.py) - Add tests for package __init__ CLI and config behavior (tests/*) and a small test script (test.py) - Add .vscode/settings.json for pytest integration - Tidy pyproject.toml: format dependencies, add dev/test dependency groups and fix trailing newline in bumpversion section
This commit is contained in:
18
tests/test_config.py
Normal file
18
tests/test_config.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from komconfig import KomConfig
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def komconfig():
|
||||
return KomConfig()
|
||||
|
||||
|
||||
def test_komconfig(komconfig):
|
||||
assert komconfig is not None
|
||||
|
||||
|
||||
def test_general(komconfig):
|
||||
assert KomConfig().general.log_file == "/var/log/komgrabber.log"
|
||||
assert KomConfig().general.log_level == "INFO"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user