Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use quote_plus instead of quote #122

Merged
merged 7 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stac_fastapi/pgstac/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Postgres API configuration."""

from typing import List, Type
from urllib.parse import quote
from urllib.parse import quote_plus as quote
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-added this after confirming locally that the test were failing!


from pydantic import BaseModel
from pydantic_settings import SettingsConfigDict
Expand Down
10 changes: 4 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -53,11 +54,9 @@ def database(postgresql_proc):
port=postgresql_proc.port,
dbname="pgstactestdb",
version=postgresql_proc.version,
password="secret",
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}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the test we also needed to quote the password.

with PgstacDB(dsn=connection) as db:
migrator = Migrate(db)
version = migrator.run_migration()
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
Loading