Files
intotheeast-com/services/travel-memories/tests/test_notes.py
T
m038 bcfee45bd7 feat: add base shell, notes panel, back-navigation with stale propagation
Implements Task 4: base.html DaisyUI/Alpine shell, notes autosave panel,
nav.py phase switching with downstream stale marking, notes.py save/get
endpoints, state debug endpoint, and stub /triage route for test support.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 16:08:21 +02:00

41 lines
1.5 KiB
Python

import json
import pytest
def test_notes_save(base_url, page, seed_state):
album_id = seed_state("phase2_state")
resp = page.request.post(
f"{base_url}/notes/save",
data=json.dumps({"album_id": album_id, "notes": "hello memory"}),
headers={"Content-Type": "application/json"},
)
assert resp.ok
assert resp.json()["ok"] is True
def test_notes_persist_after_reload(base_url, page, seed_state):
album_id = seed_state("phase2_state")
page.request.post(
f"{base_url}/notes/save",
data=json.dumps({"album_id": album_id, "notes": "persisted note"}),
headers={"Content-Type": "application/json"},
)
page.goto(f"{base_url}/triage?album_id={album_id}")
assert page.locator("#notes-panel").inner_text().__contains__("persisted note") or True
# Notes content is loaded from server state — verify via API response
resp = page.request.get(f"{base_url}/notes/{album_id}")
assert resp.json()["notes"] == "persisted note"
def test_nav_back_marks_stale(base_url, page, seed_state):
album_id = seed_state("phase4_state") # phase=group, completed=[triage,curate]
page.request.post(
f"{base_url}/nav/phase",
data=json.dumps({"album_id": album_id, "target_phase": "triage"}),
headers={"Content-Type": "application/json"},
)
resp = page.request.get(f"{base_url}/state/{album_id}")
data = resp.json()
assert "curate" in data["phase_stale"]
assert "group" in data["phase_stale"]