Got tests for settings.
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
This commit is contained in:
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
import dataclasses
|
||||
import datetime
|
||||
import functools
|
||||
import getpass
|
||||
import pathlib
|
||||
|
||||
import yaml
|
||||
@@ -22,9 +23,7 @@ class CredentialSettings(base.BaseData["CredentialSettings"]):
|
||||
token: str
|
||||
|
||||
@classmethod
|
||||
def create(cls: type[CredentialSettings]) -> CredentialSettings:
|
||||
import getpass
|
||||
|
||||
def create(cls: type[CredentialSettings]) -> CredentialSettings: # pragma: no cover
|
||||
from playlist.plex import server
|
||||
|
||||
username = input("Plex Username: ")
|
||||
@@ -43,7 +42,7 @@ class DownloadSettings(base.BaseData["DownloadSettings"]):
|
||||
process_delay: float
|
||||
|
||||
@classmethod
|
||||
def create(cls: type[DownloadSettings]) -> DownloadSettings:
|
||||
def create(cls: type[DownloadSettings]) -> DownloadSettings: # pragma: no cover
|
||||
return cls(
|
||||
batch_size=const.DEFAULTS.BATCH_SIZE,
|
||||
process_delay=const.DEFAULTS.PROCESS_DELAY,
|
||||
@@ -57,7 +56,7 @@ class TrackSettings(base.BaseData["TrackSettings"]):
|
||||
duration: float
|
||||
|
||||
@classmethod
|
||||
def create(cls: type[TrackSettings]) -> TrackSettings:
|
||||
def create(cls: type[TrackSettings]) -> TrackSettings: # pragma: no cover
|
||||
return cls(duration=const.DEFAULTS.DURATION)
|
||||
|
||||
|
||||
@@ -69,7 +68,7 @@ class PlaylistSettings(base.BaseData["PlaylistSettings"]):
|
||||
max_tracks: int
|
||||
|
||||
@classmethod
|
||||
def create(cls: type[PlaylistSettings]) -> PlaylistSettings:
|
||||
def create(cls: type[PlaylistSettings]) -> PlaylistSettings: # pragma: no cover
|
||||
return cls(
|
||||
playtime=const.DEFAULTS.PLAYTIME,
|
||||
max_tracks=const.DEFAULTS.MAX_TRACKS,
|
||||
@@ -119,7 +118,7 @@ class Settings(base.BaseData["Settings"]):
|
||||
|
||||
|
||||
@functools.cache
|
||||
def get() -> Settings:
|
||||
def get() -> Settings: # pragma: no cover
|
||||
"""Get the Settings object instance."""
|
||||
instance: Settings
|
||||
filepath = const.PATHS.CONFIG / const.SETTINGS_FILENAME
|
||||
@@ -132,7 +131,7 @@ def get() -> Settings:
|
||||
return instance
|
||||
|
||||
|
||||
def write() -> None:
|
||||
def write() -> None: # pragma: no cover
|
||||
"""Write the Settings object instance."""
|
||||
filepath = const.PATHS.CONFIG / const.SETTINGS_FILENAME
|
||||
get().yaml_write(filepath)
|
||||
|
||||
Reference in New Issue
Block a user