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"