import pytest

from app.core.config import settings


def test_default_port():
    assert settings.PORT == 6006


def test_validate_runtime_allows_local_without_secrets(monkeypatch):
    monkeypatch.setattr(settings, "ENVIRONMENT", "development")
    settings.validate_runtime()


def test_validate_runtime_requires_mongo_in_production(monkeypatch):
    monkeypatch.setattr(settings, "ENVIRONMENT", "production")
    monkeypatch.setattr(settings, "MONGO_URI", "")
    with pytest.raises(ValueError, match="MONGO_URI"):
        settings.validate_runtime()
