mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-17 15:43:28 +02:00
fix: Add default values to config classes to resolve test validation errors
- Add default instances to all nested config classes (TorrentConfig, NotificationConfig, IndexerConfig, MetadataProviderConfig, AuthConfig) - Add default values to AllEncompassingConfig fields to prevent validation errors during testing - Update GitHub workflow to copy config.example.toml before running tests - Ensures tests can run without requiring complete configuration files while maintaining production functionality Fixes test collection errors where pydantic validation failed due to missing required config sections.
This commit is contained in:
@@ -18,7 +18,7 @@ class AuthConfig(BaseSettings):
|
||||
session_lifetime: int = 60 * 60 * 24
|
||||
admin_emails: list[str] = []
|
||||
email_password_resets: bool = False
|
||||
openid_connect: OpenIdConfig
|
||||
openid_connect: OpenIdConfig = OpenIdConfig()
|
||||
|
||||
@property
|
||||
def jwt_signing_key(self):
|
||||
|
||||
@@ -54,13 +54,13 @@ class AllEncompassingConfig(BaseSettings):
|
||||
This class is used to load all configurations from the environment variables.
|
||||
It combines the BasicConfig with any additional configurations needed.
|
||||
"""
|
||||
misc: BasicConfig
|
||||
torrents: TorrentConfig
|
||||
notifications: NotificationConfig
|
||||
metadata: MetadataProviderConfig
|
||||
indexers: IndexerConfig
|
||||
database: DbConfig
|
||||
auth: AuthConfig
|
||||
misc: BasicConfig = BasicConfig()
|
||||
torrents: TorrentConfig = TorrentConfig()
|
||||
notifications: NotificationConfig = NotificationConfig()
|
||||
metadata: MetadataProviderConfig = MetadataProviderConfig()
|
||||
indexers: IndexerConfig = IndexerConfig()
|
||||
database: DbConfig = DbConfig()
|
||||
auth: AuthConfig = AuthConfig()
|
||||
|
||||
@classmethod
|
||||
def settings_customise_sources(
|
||||
|
||||
@@ -35,8 +35,8 @@ class ScoringRuleSet(BaseSettings):
|
||||
|
||||
|
||||
class IndexerConfig(BaseSettings):
|
||||
prowlarr: ProwlarrConfig
|
||||
jackett: JackettConfig
|
||||
prowlarr: ProwlarrConfig = ProwlarrConfig()
|
||||
jackett: JackettConfig = JackettConfig()
|
||||
title_scoring_rules: list[TitleScoringRule] = []
|
||||
indexer_flag_scoring_rules: list[IndexerFlagScoringRule] = []
|
||||
scoring_rule_sets: list[ScoringRuleSet] = []
|
||||
|
||||
@@ -10,5 +10,5 @@ class TvdbConfig(BaseSettings):
|
||||
|
||||
|
||||
class MetadataProviderConfig(BaseSettings):
|
||||
tvdb: TvdbConfig
|
||||
tmdb: TmdbConfig
|
||||
tvdb: TvdbConfig = TvdbConfig()
|
||||
tmdb: TmdbConfig = TmdbConfig()
|
||||
|
||||
@@ -37,8 +37,8 @@ class PushoverConfig(BaseSettings):
|
||||
|
||||
|
||||
class NotificationConfig(BaseSettings):
|
||||
smtp_config: EmailConfig
|
||||
email_notifications: EmailNotificationsConfig
|
||||
gotify: GotifyConfig
|
||||
ntfy: NtfyConfig
|
||||
pushover: PushoverConfig
|
||||
smtp_config: EmailConfig = EmailConfig()
|
||||
email_notifications: EmailNotificationsConfig = EmailNotificationsConfig()
|
||||
gotify: GotifyConfig = GotifyConfig()
|
||||
ntfy: NtfyConfig = NtfyConfig()
|
||||
pushover: PushoverConfig = PushoverConfig()
|
||||
|
||||
@@ -30,6 +30,6 @@ class SabnzbdConfig(BaseSettings):
|
||||
|
||||
|
||||
class TorrentConfig(BaseSettings):
|
||||
qbittorrent: QbittorrentConfig
|
||||
transmission: TransmissionConfig
|
||||
sabnzbd: SabnzbdConfig
|
||||
qbittorrent: QbittorrentConfig = QbittorrentConfig()
|
||||
transmission: TransmissionConfig = TransmissionConfig()
|
||||
sabnzbd: SabnzbdConfig = SabnzbdConfig()
|
||||
|
||||
Reference in New Issue
Block a user