Remove 7 test files fully covered by e2e tests (admin, account, models, API routes, integration MFA/OIDC, notifications). Trim 5 more files to keep only edge cases not reachable via e2e. Fix conftest to replace wiregui.db engine/session at import time so all code uses the test database. Use session-scoped tables with per-test savepoint isolation to prevent data leaking between tests.
11 lines
457 B
Python
11 lines
457 B
Python
"""Tests for magic link authentication — token subject validation."""
|
|
|
|
from wiregui.auth.jwt import create_access_token, decode_access_token
|
|
|
|
|
|
def test_magic_link_token_wrong_user():
|
|
"""Token should only be valid for the intended user."""
|
|
token = create_access_token(user_id="user-A", role="admin")
|
|
payload = decode_access_token(token)
|
|
assert payload["sub"] == "user-A"
|
|
# Caller is responsible for checking sub matches the URL user_id
|