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
19 lines
608 B
Python
19 lines
608 B
Python
"""E2E test configuration.
|
|
|
|
This conftest.py overrides the asyncio_mode setting from the root pyproject.toml
|
|
to disable pytest-asyncio for E2E tests. This is necessary because pytest-playwright
|
|
manages its own event loop and conflicts with pytest-asyncio.
|
|
|
|
See: https://github.com/pytest-dev/pytest-asyncio/issues/706
|
|
"""
|
|
|
|
|
|
def pytest_configure(config):
|
|
"""Configure pytest for E2E tests.
|
|
|
|
Disable pytest-asyncio for E2E tests since pytest-playwright
|
|
manages its own event loop.
|
|
"""
|
|
# Override asyncio_mode to prevent pytest-asyncio from interfering
|
|
config.option.asyncio_mode = None
|