From 8d4488d03a2ce5d1c3cefc6179c86112ce6b12f1 Mon Sep 17 00:00:00 2001 From: Adam <41971533+jcadam14@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:47:01 -0500 Subject: [PATCH] Escaped escape --- src/config.py | 4 ++-- tests/app/test_config.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.py b/src/config.py index 01e2f7c..cf33c8a 100644 --- a/src/config.py +++ b/src/config.py @@ -4,7 +4,7 @@ from urllib import parse from typing import Dict, Any -from pydantic import TypeAdapter, field_validator, FieldValidationInfo +from pydantic import TypeAdapter, field_validator, ValidationInfo from pydantic.networks import HttpUrl, PostgresDsn from pydantic.types import SecretStr from pydantic_settings import BaseSettings, SettingsConfigDict @@ -36,7 +36,7 @@ def __init__(self, **data): @field_validator("inst_conn", mode="before") @classmethod - def encode_db_password(cls, postgres_dsn, info: FieldValidationInfo) -> Any: + def encode_db_password(cls, postgres_dsn, info: ValidationInfo) -> Any: log = logging.getLogger() pwd = re.search(".*:.*:(.*)@", postgres_dsn) if pwd: diff --git a/tests/app/test_config.py b/tests/app/test_config.py index 53c5357..a8908d0 100644 --- a/tests/app/test_config.py +++ b/tests/app/test_config.py @@ -3,7 +3,7 @@ def test_psql_password_encoding(): - mock_config = {"inst_conn": "postgresql+asyncpg://test:\z9-/tgb76@test/test"} + mock_config = {"inst_conn": "postgresql+asyncpg://test:\\z9-/tgb76@test/test"} settings = Settings(**mock_config) assert str(settings.inst_conn) == "postgresql+asyncpg://test:%5Cz9-%2Ftgb76@test/test"