import pytest
from app.config import Settings

def test_settings_load_from_env(monkeypatch):
    """Test that Settings loads from environment."""
    monkeypatch.setenv("DATABASE_URL", "mysql+aiomysql://user:pass@localhost/db")
    monkeypatch.setenv("SMTP_HOST", "smtp.test.com")
    monkeypatch.setenv("SMTP_PORT", "587")
    monkeypatch.setenv("SMTP_USER", "test@test.com")
    monkeypatch.setenv("SMTP_PASSWORD", "password")
    monkeypatch.setenv("RECAPTCHA_SECRET", "secret")
    monkeypatch.setenv("RECAPTCHA_SITE_KEY", "site_key")
    monkeypatch.setenv("GITBUCKET_URL", "http://test.com/api")

    settings = Settings()
    assert settings.database_url == "mysql+aiomysql://user:pass@localhost/db"
    assert settings.smtp_host == "smtp.test.com"
