Skip to content

Commit

Permalink
Escaped escape
Browse files Browse the repository at this point in the history
  • Loading branch information
jcadam14 committed Jan 2, 2024
1 parent bb85f6b commit 8d4488d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/app/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 8d4488d

Please sign in to comment.