Files
inkwell/tests/test_labels.py
T
bvandeusenandClaude Opus 5.5 b74dc7c1fe
CI & Build / Python lint (push) Successful in 2s
CI & Build / Build now, or wait for Android? (push) Successful in 2s
Android / Build, or is the channel already serving this? (push) Successful in 3s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 2s
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Skipped
Desktop (Tauri) / Tauri desktop (Linux) (push) Skipped
Desktop (Tauri) / Windows installer (cross-compiled) (push) Skipped
Desktop (Tauri) / Update manifest (push) Skipped
CI & Build / Web typecheck and unit tests (push) Successful in 8s
CI & Build / Python tests (push) Successful in 13s
Android / Core and FFI clippy and tests (push) Successful in 25s
CI & Build / integration (push) Successful in 1m31s
CI & Build / Build & push image (push) Skipped
Android / Kotlin + Rust (APK) (push) Successful in 6m41s
Android / Build the server image (push) Successful in 1s
One app fixture for the tests, and ViewModels built where they are used
The tests' `app` fixture, the same two lines in eleven files, now lives once in
tests/conftest.py.

On Android each ViewModel carried a companion `factory` that only wrapped its
constructor in viewModelFactory { initializer { … } }. MainActivity now builds
each one with Compose's viewModel { … } builder, so the five factories and their
imports are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 21:25:05 -04:00

39 lines
1.1 KiB
Python

import uuid
from inkwell.models.label import Label
from inkwell.serialize import serialize_label
def test_serialize_label_shape():
# The base {id, name, color} shape the labels API and (S4) sync deltas both build on.
lid = uuid.uuid4()
assert serialize_label(Label(id=lid, name="ideas", color="teal")) == {
"id": str(lid),
"name": "ideas",
"color": "teal",
}
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
async def test_merge_label_requires_auth(app):
client = app.test_client()
resp = await client.post(
"/api/labels/00000000-0000-0000-0000-000000000000/merge",
json={"into": "00000000-0000-0000-0000-000000000001"},
)
assert resp.status_code == 401