Refactor code for improved readability and consistency
Test / test (push) Successful in 15s

- Reformatted function signatures in `organization_service.py` and `task_service.py` for better alignment.
- Updated import statements across multiple files for consistency and organization.
- Enhanced test files by improving formatting and ensuring consistent use of async session factories.
- Added type hints and improved type safety in various service and test files.
- Adjusted `pyproject.toml` to include configuration for isort, mypy, and ruff for better code quality checks.
- Cleaned up unused imports and organized existing ones in several test files.
This commit is contained in:
Artem Kashaev
2025-12-01 16:18:03 +05:00
parent eecb74c523
commit 5fcb574aca
62 changed files with 765 additions and 476 deletions
+7 -7
View File
@@ -1,15 +1,15 @@
"""API tests for authentication endpoints."""
from __future__ import annotations
import pytest
from httpx import AsyncClient
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
from app.core.security import password_hasher
from app.models.organization import Organization
from app.models.organization_member import OrganizationMember, OrganizationRole
from app.models.user import User
from httpx import AsyncClient
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
@pytest.mark.asyncio
@@ -37,7 +37,7 @@ async def test_register_user_creates_organization_membership(
assert user is not None
organization = await session.scalar(
select(Organization).where(Organization.name == payload["organization_name"])
select(Organization).where(Organization.name == payload["organization_name"]),
)
assert organization is not None
@@ -45,7 +45,7 @@ async def test_register_user_creates_organization_membership(
select(OrganizationMember).where(
OrganizationMember.organization_id == organization.id,
OrganizationMember.user_id == user.id,
)
),
)
assert membership is not None
assert membership.role == OrganizationRole.OWNER
@@ -71,7 +71,7 @@ async def test_register_user_without_organization_succeeds(
assert user is not None
membership = await session.scalar(
select(OrganizationMember).where(OrganizationMember.user_id == user.id)
select(OrganizationMember).where(OrganizationMember.user_id == user.id),
)
assert membership is None