Skip to content

Commit 362ecae

Browse files
author
phernandez
committed
formatting and linting
1 parent 0cc1bb7 commit 362ecae

20 files changed

Lines changed: 41 additions & 61 deletions

TODO.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
- https://docs.render.com/docker
3737
- [ ] multi tenant
3838
- [ ] postgres row level security
39-
- [ ] stripe integration
39+
- [ ] subscriptions
40+
- stripe integration
41+
- lago
4042
- [ ] webhooks
4143
- [ ] queueing
4244
- [ ] static object storage

foundation/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
from modules.foundation.api.routes import api_router # Import the router from api module
1717
from modules.foundation.web.routes import html_router # Import the router from web module
18+
from fastapi.exception_handlers import (
19+
http_exception_handler,
20+
)
1821

1922
# delete all existing default loggers
2023
logger.remove()
@@ -49,9 +52,6 @@ async def on_startup(): # pragma: no cover
4952
init_data.main()
5053

5154

52-
from fastapi.exception_handlers import (
53-
http_exception_handler,
54-
)
5555

5656

5757
@app.exception_handler(StarletteHTTPException)

foundation/conftest.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
import asyncio
2-
from typing import AsyncGenerator, Generator
2+
from typing import AsyncGenerator
33

44
import pytest
55
import pytest_asyncio
6-
from httpx import AsyncClient
76
from sqlalchemy import event
87
from sqlalchemy.ext.asyncio import AsyncSession
98
from sqlalchemy.orm import sessionmaker
109

11-
from foundation.app import app
1210
from foundation.core import security
1311
from foundation.core.db import engine
1412
from foundation.core.repository import Repository
15-
from foundation.users.deps import get_user_repository
1613
from foundation.users.models import User
1714
from foundation.test_utils import (
18-
get_superuser_auth_token_headers,
1915
random_email,
2016
)
2117

foundation/core/deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async def get_async_session() -> AsyncGenerator[AsyncSession, None]: # pragma:
1616
async with async_sessionmaker() as session:
1717
try:
1818
yield session
19-
except SQLAlchemyError as e:
19+
except SQLAlchemyError:
2020
# Handle SQLAlchemy specific exceptions
2121
raise HTTPException(
2222
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,

foundation/core/repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async def delete(self, entity_id: UUID) -> bool:
8686
await self.session.delete(entity)
8787
await self.session.commit()
8888
return True
89-
except NoResultFound as e:
89+
except NoResultFound:
9090
return False
9191

9292
async def count(self, query: Executable | None = None) -> int:

foundation/test/test_main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from typing import AsyncGenerator, Generator
21

32
import pytest
43
from foundation.app import app

foundation/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async def get_superuser_auth_token_headers(client: AsyncClient) -> dict[str, str
2727

2828

2929
async def get_auth_token(client: AsyncClient, login_data: dict[str, str]) -> AuthToken: # pragma: no cover
30-
r = await client.post(f"/api/auth/login/access-token", data=login_data)
30+
r = await client.post("/api/auth/login/access-token", data=login_data)
3131
assert r.status_code == 200, r.text
3232
return AuthToken.model_validate(r.json())
3333

foundation/users/services.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from typing import Any, Sequence, Tuple
1+
from typing import Any, Sequence
22
from uuid import UUID
33

44
from loguru import logger
5-
from sqlalchemy import select, func, Select
5+
from sqlalchemy import select, func
66
from sqlalchemy.exc import IntegrityError
77

88
from foundation.core.config import settings

foundation/users/test/test_user_pagination.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import uuid
21
from unittest.mock import Mock
32

43
import pytest
@@ -8,16 +7,11 @@
87
from foundation.users.deps import UserPagination
98
from foundation.users.models import User
109
from foundation.core.pagination import Paginator
11-
import pytest
12-
import pytest_asyncio
1310
from mockito import when, mock
14-
from sqlalchemy import select
1511
from starlette import requests
1612
from starlette.datastructures import URL
1713

1814
from foundation.core.repository import Repository
19-
from foundation.users.models import User
20-
from foundation.core.pagination import Paginator
2115

2216
pytestmark = pytest.mark.asyncio
2317

@@ -53,7 +47,7 @@ async def test_user_pagination(user_repository):
5347
assert paginator.query == query
5448
assert paginator.page_size == page_size
5549
assert paginator.order_by == order_by
56-
assert paginator.ascending == False
50+
assert paginator.ascending is False
5751
assert paginator.repository == user_repository
5852
assert paginator.request == request
5953

foundation/users/test/test_user_services.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
import uuid
2-
from unittest.mock import Mock
32

43
import pytest
54
import pytest_asyncio
6-
from mockito import mock, when, unstub
7-
from sqlalchemy import select
8-
from fastapi import Request
95

10-
from foundation.core import emails
11-
from foundation.core.emails import send_email
126
from foundation.core.security import verify_password
137
from foundation.users.models import User
148
from foundation.users.services import (
@@ -157,7 +151,7 @@ async def test_update_user_fails(user_service, sample_user: User):
157151
"is_active": True,
158152
"is_superuser": True,
159153
}
160-
with pytest.raises(UserValueError, match=f"user can not be updated"):
154+
with pytest.raises(UserValueError, match="user can not be updated"):
161155
await user_service.update_user(user_id=created_user.id, update_dict=user_update)
162156

163157

0 commit comments

Comments
 (0)