import pytest from pydantic import ValidationError from app.config import Settings def production_settings(**changes) -> Settings: values = { "deployment_environment": "production", "admin_token": "a" * 32, "rate_limit_secret": "r" * 32, "s3_access_key": "access-key-1234", "s3_secret_key": "s" * 32, "s3_public_endpoint_url": "https://files.rf4spotter.ru", "cors_origins": ["https://rf4spotter.ru"], "seed_demo_data": False, } return Settings(**(values | changes)) def test_production_settings_accept_real_domains_and_secrets() -> None: settings = production_settings() assert settings.cors_origins == ["https://rf4spotter.ru"] @pytest.mark.parametrize(("field", "value"), [ ("admin_token", "change-me-in-production"), ("rate_limit_secret", "short"), ("s3_access_key", "rf4-local"), ("s3_secret_key", "rf4-local-secret"), ("cors_origins", ["http://rf4spotter.ru"]), ("s3_public_endpoint_url", "http://files.rf4spotter.ru"), ("seed_demo_data", True), ]) def test_production_settings_reject_insecure_values(field: str, value: object) -> None: with pytest.raises(ValidationError): production_settings(**{field: value})