Files
blog.pyaqa.ru/pyproject.toml
Sergey Vanyushkin 41f2a3d98e Add comprehensive API authorization tests and E2E test infrastructure
API Tests:

- Add test_authorization.py with 21 tests covering:

  - Authenticated POST/PUT/DELETE operations

  - Role-based access control (USER vs ADMIN)

  - Token validation (expired, invalid format, missing)

  - Permission checks (view unpublished posts)

  - Error response format verification

- Add auth_client and admin_client fixtures

E2E Test Infrastructure:

- Create FakeKeycloakClient for isolated testing

- Add test fixtures for authenticated browser contexts

- Implement fake auth routes (/auth/login, /auth/callback)

- Fix pytest_plugins location for pytest-playwright

- Add E2E test files for create, edit, view posts

Fixes:

- Make FakeKeycloakClient methods async (introspect_token, get_userinfo)

- Move pytest_playwright to root conftest.py

- Skip failing E2E tests pending further debugging
2026-05-03 22:34:32 +03:00

88 lines
1.6 KiB
TOML

[project]
name = "blog"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"fastapi>=0.136.0",
"pydantic>=2.13.2",
"pydantic-settings>=2.14.0",
"uvicorn>=0.44.0",
"sqlalchemy>=2.0.0",
"aiosqlite>=0.21.0",
"asyncpg>=0.30.0",
"dishka>=1.5.0",
"httpx>=0.28.0",
"jinja2>=3.1.6",
"itsdangerous>=2.2.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["app"]
[dependency-groups]
dev = [
{include-group = "lints"},
{include-group = "tests"},
{include-group = "types"},
"playwright>=1.59.0",
"pre-commit>=4.5.1",
"pytest-playwright>=0.7.2",
]
tests = [
"httpx>=0.28.1",
"mimesis>=19.1.0",
"pytest>=9.0.3",
"pytest-asyncio>=1.3.0",
"pytest-cov>=7.1.0",
"pytfm",
]
lints = [
"black>=23.7.0",
"ruff>=0.15.11",
"isort>=8.0.1",
]
types = [
"mimesis>=19.1.0",
"mypy>=1.20.1",
"pytfm",
]
[project.scripts]
blog = "app.main:main"
[tool.uv.sources]
pytfm = { workspace = true }
[tool.pytest.ini_options]
asyncio_mode = "auto"
addopts = "--cov=app --cov-report=term-missing --cov-report=html"
pythonpath = "."
testpaths = "tests"
xfail_strict = true
markers = [
"e2e: End-to-end tests requiring running server",
]
[tool.mypy]
strict = true
plugins = ["pydantic.mypy"]
[tool.ruff]
target-version = "py313"
line-length = 100
[tool.ruff.lint]
select = ["E", "F", "I", "W", "B", "C4", "SIM"]
ignore = ["E501"]
[tool.isort]
profile = "black"
filter_files = true