Реализована интеграция с СМС провайдером
This commit is contained in:
@@ -44,9 +44,15 @@ class InfrastructureConfigTests(unittest.TestCase):
|
||||
application = (ROOT / "infra/compose/application.yml").read_text(encoding="utf-8")
|
||||
self.assertIn("networks: [backend, observability, egress]", application)
|
||||
self.assertIn("networks: [public, backend, observability]", application)
|
||||
self.assertEqual(
|
||||
application.count(
|
||||
"IDGTL_SMS_API_KEY: ${IDGTL_SMS_API_KEY:?IDGTL_SMS_API_KEY is required}"
|
||||
),
|
||||
1,
|
||||
)
|
||||
|
||||
jobs = (ROOT / "deployment/docker-compose.jobs.yml").read_text(encoding="utf-8")
|
||||
self.assertEqual(jobs.count("networks: [backend, egress]"), 4)
|
||||
self.assertEqual(jobs.count("networks: [backend, egress]"), 5)
|
||||
|
||||
observability = (ROOT / "observability/docker-compose.yml").read_text(encoding="utf-8")
|
||||
self.assertIn("networks: [observability, backend, egress]", observability)
|
||||
@@ -93,6 +99,10 @@ class InfrastructureConfigTests(unittest.TestCase):
|
||||
self.assertIn("location = /auth/callback", site)
|
||||
self.assertIn("location ^~ /auth/resources/", site)
|
||||
self.assertIn("location ^~ /auth/realms/", site)
|
||||
self.assertIn("location = /callbacks/idgtl/sms", site)
|
||||
self.assertIn("allow 185.203.96.7;", site)
|
||||
self.assertIn("proxy_pass http://sms_service_upstream;", site)
|
||||
self.assertIn("upstream sms_service_upstream", config)
|
||||
self.assertNotIn("security-headers.conf", proxy_keycloak)
|
||||
self.assertNotIn("X-Frame-Options", proxy_keycloak)
|
||||
|
||||
@@ -134,6 +144,7 @@ class InfrastructureConfigTests(unittest.TestCase):
|
||||
self.assertIn("frontend-test-site", application)
|
||||
self.assertIn("frontend-static:/output", application)
|
||||
for service, command in (
|
||||
("sms-worker:", "han-sms-worker"),
|
||||
("delivery-worker:", "han-delivery-worker"),
|
||||
("safety-recovery-worker:", "han-safety-worker"),
|
||||
("cleanup-worker:", "han-cleanup-worker"),
|
||||
@@ -169,10 +180,13 @@ class InfrastructureConfigTests(unittest.TestCase):
|
||||
"api-backend/alembic/env.py",
|
||||
"bitrix-local-app/alembic/env.py",
|
||||
"bitrix-sync/alembic/env.py",
|
||||
"sms-service/migrations/env.py",
|
||||
):
|
||||
env_script = (ROOT / relative_path).read_text(encoding="utf-8")
|
||||
self.assertIn('.replace("%", "%%")', env_script, relative_path)
|
||||
self.assertIn("create_postgres_engine", env_script, relative_path)
|
||||
sms_db = (ROOT / "sms-service/app/db.py").read_text(encoding="utf-8")
|
||||
self.assertNotIn("server_settings", sms_db)
|
||||
|
||||
def test_contact_sync_qualifies_pgcrypto_digest(self) -> None:
|
||||
initial = (
|
||||
@@ -185,7 +199,7 @@ class InfrastructureConfigTests(unittest.TestCase):
|
||||
self.assertIn("public.digest(", initial)
|
||||
self.assertIn("public.digest(", fix)
|
||||
self.assertIn('down_revision: str | None = "0001_initial"', fix)
|
||||
self.assertIn('revision != "0003_consent_audit"', main)
|
||||
self.assertIn('revision != "0005_otp_settings"', main)
|
||||
|
||||
def test_consent_audit_migration_supports_existing_and_fresh_databases(self) -> None:
|
||||
migration = (
|
||||
@@ -212,10 +226,11 @@ class InfrastructureConfigTests(unittest.TestCase):
|
||||
"KEYCLOAK_OTP_MOCK_ENABLED",
|
||||
"KEYCLOAK_OTP_MOCK_CODE",
|
||||
"KEYCLOAK_OTP_HMAC_KEY",
|
||||
"KEYCLOAK_OTP_TTL_SEC",
|
||||
"KEYCLOAK_OTP_SETTINGS_MAX_STALE_SEC",
|
||||
"KEYCLOAK_SETTINGS_BRIDGE_URL",
|
||||
"KEYCLOAK_SETTINGS_BRIDGE_TOKEN",
|
||||
"KEYCLOAK_SMS_SERVICE_URL",
|
||||
"KEYCLOAK_SMS_SERVICE_TOKEN",
|
||||
):
|
||||
self.assertIn(f" {variable}:", application)
|
||||
|
||||
@@ -229,6 +244,8 @@ class InfrastructureConfigTests(unittest.TestCase):
|
||||
"CURSOR_HMAC_SECRET=",
|
||||
"BITRIX_TOKEN_ENCRYPTION_KEY=",
|
||||
"KEYCLOAK_INTERNAL_URL=http://keycloak:8080/auth",
|
||||
"KEYCLOAK_SMS_SERVICE_URL=http://sms-service:8080",
|
||||
"IDGTL_SMS_CALLBACK_PUBLIC_URL=https://chat.example.ru/callbacks/idgtl/sms",
|
||||
):
|
||||
self.assertIn(required, example)
|
||||
materialized = example.replace("change-me", "0123456789abcdef0123456789abcdef")
|
||||
|
||||
Reference in New Issue
Block a user