feat: add production deployment for rf4spotter.ru
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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"],
|
||||
}
|
||||
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"),
|
||||
])
|
||||
def test_production_settings_reject_insecure_values(field: str, value: object) -> None:
|
||||
with pytest.raises(ValidationError):
|
||||
production_settings(**{field: value})
|
||||
Reference in New Issue
Block a user