From e432c1c5429a056de6b7925c4a83d34b27722e51 Mon Sep 17 00:00:00 2001 From: Andrey Epifancev Date: Sat, 3 Oct 2026 18:23:21 +0400 Subject: [PATCH] =?UTF-8?q?test:=20test=5Fdefaults=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=8F=D0=B5=D1=82=20=D1=83=D0=BC=D0=BE=D0=BB?= =?UTF-8?q?=D1=87=D0=B0=D0=BD=D0=B8=D1=8F=20Settings=20=D0=B1=D0=B5=D0=B7?= =?UTF-8?q?=20env-=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.1 --- api/tests/test_config.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/api/tests/test_config.py b/api/tests/test_config.py index 42fadda..e014a37 100644 --- a/api/tests/test_config.py +++ b/api/tests/test_config.py @@ -29,10 +29,34 @@ def test_env_test_is_read(clean_env: pytest.MonkeyPatch) -> None: def test_defaults(clean_env: pytest.MonkeyPatch) -> None: - """Значения по умолчанию: claim email и параметры outbox.""" - s = Settings(_env_file=API_DIR / ".env.test") # type: ignore[call-arg] + """Значения по умолчанию классов настроек: env-файла нет, заданы только обязательные OPENBAO__*.""" + required = { + "OPENBAO__DATABASE__DATABASE_URL": "postgresql+asyncpg://u:p@localhost:5432/d", + "OPENBAO__MINIO__MINIO_URL": "localhost:9000", + "OPENBAO__MINIO__MINIO_ADMIN_LOGIN": "login", + "OPENBAO__MINIO__MINIO_ADMIN_PASSWORD": "password", + "OPENBAO__MINIO__MINIO_BUCKET": "bucket", + "OPENBAO__NATS__NATS_URL": "nats://localhost:4222", + "OPENBAO__SMB__SMB_HOST": "host", + "OPENBAO__SMB__SMB_PATH": "path", + "OPENBAO__SMB__SMB_LOGIN": "login", + "OPENBAO__SMB__SMB_PASSWORD": "password", + } + for key, value in required.items(): + clean_env.setenv(key, value) + s = Settings(_env_file=None) # type: ignore[call-arg] + assert s.DEBUG is False + assert s.AUTH_DEV_ISSUER is False + assert s.AUTH_DEV_SECRET == "" + assert s.AUTH_JWKS_URL == "" + assert s.AUTH_PUBLIC_KEY == "" + assert s.AUTH_ISSUER == "" + assert s.AUTH_AUDIENCE == "" assert s.AUTH_EMAIL_CLAIM == "email" + assert s.NATS_ENABLED is False assert (s.OUTBOX_POLL_SECONDS, s.ACK_TIMEOUT_SECONDS, s.OUTBOX_MAX_REPUBLISH) == (5, 30, 3) + assert s.OPENBAO.NATS.NATS_SEED == "" + assert s.OPENBAO.NATS.NATS_JWT == "" def test_empty_nats_seed_and_jwt_allowed(clean_env: pytest.MonkeyPatch) -> None: