Files
thoughtsync/tests/test_labels.py
T
bvandeusenandClaude Opus 4.8 4d1fc1bdf9
CI & Build / Python lint (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 5s
CI & Build / Python tests (push) Successful in 9s
CI & Build / Build & push image (push) Successful in 32s
M2 labels backend: labels + note_labels, CRUD, note-label set, filter
- Label + NoteLabel models; migration 0004 (labels unique per owner + note_labels
  join, cascade).
- /api/labels: list/create(idempotent)/rename(clash-checked)/delete, owner-scoped.
- PUT /api/notes/<id>/labels to set a note's labels (validated against owned).
- Note responses now include labels[] (merged via one explicit join query — no
  lazy relationship); GET /api/notes?...&label=<id> filters by label.
- DB-free auth-guard tests for labels endpoints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
2026-07-19 21:43:21 -04:00

24 lines
512 B
Python

import pytest
from thoughtsync.app import create_app
@pytest.fixture
def app():
return create_app()
async def test_labels_requires_auth(app):
client = app.test_client()
resp = await client.get("/api/labels")
assert resp.status_code == 401
async def test_set_note_labels_requires_auth(app):
client = app.test_client()
resp = await client.put(
"/api/notes/00000000-0000-0000-0000-000000000000/labels",
json={"label_ids": []},
)
assert resp.status_code == 401