Skip to content

Commit a476666

Browse files
authored
Merge pull request #8 from hexfrost/beta-0.1.7
Beta 0.1.7
2 parents 21028aa + d0f08c7 commit a476666

File tree

8 files changed

+18
-14
lines changed

8 files changed

+18
-14
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies = [
2222
"sqlalchemy-utils>=0.41.2",
2323
]
2424
name = "hexfrost-toolbox"
25-
version = "0.1.6b"
25+
version = "0.1.7b"
2626
description = "Open source library with useful utils for fast development"
2727
readme = "README.md"
2828

tests/fixtures/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def db_settings():
99
POSTGRES_USER="postgres",
1010
POSTGRES_PASSWORD = "postgres",
1111
POSTGRES_HOST = "0.0.0.0",
12-
POSTGRES_PORT = "5432",
12+
POSTGRES_PORT = 5432,
1313
POSTGRES_DB = "postgres"
1414
)
1515
return data

toolbox/auth/__init__.py

Whitespace-only changes.

toolbox/auth/middlewares/__init__.py

Whitespace-only changes.

toolbox/auth/middlewares/fastapi_.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ def set_settings(cls, settings: BearerTokenMiddlewareSettings):
4040
cls._exclude_paths = settings.exclude_paths
4141
cls._token_validator = settings.token_validator
4242

43+
@classmethod
44+
def update_settings(cls, token_validator=Callable, exclude_paths=None):
45+
cls._token_validator = token_validator
46+
if not exclude_paths:
47+
cls._exclude_paths = []
48+
else:
49+
cls._exclude_paths = exclude_paths
50+
4351
async def _is_token_valid(self, token: str) -> bool:
4452
if await self._token_validator(token):
4553
return True

toolbox/sqlalchemy/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DatabaseConnectionSettings:
1717
POSTGRES_USER: str
1818
POSTGRES_PASSWORD: str
1919
POSTGRES_HOST: str
20-
POSTGRES_PORT: str
20+
POSTGRES_PORT: int
2121
POSTGRES_DB: str
2222
SCHEMA_MAPPING: dict | None = None
2323

toolbox/testing.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,13 @@ async def temporary_database(settings: "DatabaseConnectionSettings", base_model,
5252
except Exception as e:
5353
logger.error({"msg": e})
5454

55-
engine = db_manager.get_engine()
56-
async with engine.begin() as connection:
57-
try:
58-
await connection.run_sync(base_model.metadata.create_all)
59-
60-
except Exception as e:
61-
logger.error({"msg": f"Error creating schema: {e}"})
62-
63-
raise
55+
from sqlalchemy import create_engine
6456

65-
yield
57+
engine = create_engine(settings.get_dsn())
58+
base_model.metadata.drop_all(bind=engine)
59+
base_model.metadata.create_all(bind=engine)
60+
yield
61+
base_model.metadata.drop_all(bind=engine)
6662

6763
try:
6864
conn = await asyncpg.connect(dsn=dsn)

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)