* feat(infra): backend cookiecutter template with fastapi tortoise * feat(infra): cli cookiecutter template with typer entry point * feat(infra): fullstack cookiecutter template with sveltekit frontend * test(infra): cookiecutter template tests and render fixes * style(infra): ruff cleanup for cookiecutter template tests * style(infra): ruff format cookiecutter template tests * fix(infra): handle use_db no use_auth no in cookiecutter --------- Co-authored-by: opencode-agent <agent@opencode.local>
26 lines
No EOL
933 B
Python
26 lines
No EOL
933 B
Python
"""Auth flow tests — /register, /login (only when use_auth=yes)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.skip(reason="requires DB fixture; wire up after issue #2 (project-status compat)")
|
|
async def test_register(client) -> None:
|
|
"""POST /api/v1/auth/register creates a user."""
|
|
response = await client.post(
|
|
"/api/v1/auth/register",
|
|
json={"username": "newuser", "email": "new@test.local", "password": "password123"},
|
|
)
|
|
assert response.status_code == 201
|
|
|
|
|
|
@pytest.mark.skip(reason="requires DB fixture; wire up after issue #2 (project-status compat)")
|
|
async def test_login_returns_token(client) -> None:
|
|
"""POST /api/v1/auth/login returns a JWT."""
|
|
response = await client.post(
|
|
"/api/v1/auth/login",
|
|
json={"username": "tester", "password": "password123"},
|
|
)
|
|
assert response.status_code == 200
|
|
assert "access_token" in response.json() |