diff --git a/stac_fastapi/pgstac/config.py b/stac_fastapi/pgstac/config.py index 48f050d9..2c3b7783 100644 --- a/stac_fastapi/pgstac/config.py +++ b/stac_fastapi/pgstac/config.py @@ -1,8 +1,7 @@ """Postgres API configuration.""" from typing import List, Type -from urllib.parse import quote - +from urllib.parse import quote_plus as quote from pydantic import BaseModel from pydantic_settings import SettingsConfigDict diff --git a/tests/conftest.py b/tests/conftest.py index 18bcfb83..edb916b5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,6 +4,7 @@ import os import time from typing import Callable, Dict +from urllib.parse import quote_plus as quote from urllib.parse import urljoin import asyncpg @@ -55,9 +56,7 @@ def database(postgresql_proc): version=postgresql_proc.version, password="a2Vw:yk=)CdSis[fek]tW=/o", ) as jan: - connection = ( - f"postgresql://{jan.user}:{jan.password}@{jan.host}:{jan.port}/{jan.dbname}" - ) + connection = f"postgresql://{jan.user}:{quote(jan.password)}@{jan.host}:{jan.port}/{jan.dbname}" with PgstacDB(dsn=connection) as db: migrator = Migrate(db) version = migrator.run_migration() @@ -68,7 +67,7 @@ def database(postgresql_proc): @pytest.fixture(autouse=True) async def pgstac(database): - connection = f"postgresql://{database.user}:{database.password}@{database.host}:{database.port}/{database.dbname}" + connection = f"postgresql://{database.user}:{quote(database.password)}@{database.host}:{database.port}/{database.dbname}" yield conn = await asyncpg.connect(dsn=connection) await conn.execute( @@ -99,7 +98,6 @@ async def pgstac(database): ) def api_client(request, database): hydrate, prefix, response_model = request.param - api_settings = Settings( postgres_user=database.user, postgres_pass=database.password,