Files
MediaManager/media_manager/notification/config.py
wjbeckett 0158ac1040 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.
2025-07-18 16:56:19 +10:00

45 lines
1.1 KiB
Python

from pydantic_settings import BaseSettings
class EmailConfig(BaseSettings):
smtp_host: str = ""
smtp_port: int = 587
smtp_user: str = ""
smtp_password: str = ""
from_email: str = ""
use_tls: bool = False
class EmailNotificationsConfig(BaseSettings):
enabled: bool = False
emails: list[str] = [] # the email addresses to send notifications to
class GotifyConfig(BaseSettings):
enabled: bool = False
api_key: str | None = None
url: str | None = (
None # e.g. https://gotify.example.com (note lack of trailing slash)
)
class NtfyConfig(BaseSettings):
enabled: bool = False
url: str | None = (
None # e.g. https://ntfy.sh/your-topic (note lack of trailing slash)
)
class PushoverConfig(BaseSettings):
enabled: bool = False
api_key: str | None = None
user: str | None = None
class NotificationConfig(BaseSettings):
smtp_config: EmailConfig = EmailConfig()
email_notifications: EmailNotificationsConfig = EmailNotificationsConfig()
gotify: GotifyConfig = GotifyConfig()
ntfy: NtfyConfig = NtfyConfig()
pushover: PushoverConfig = PushoverConfig()