diff --git a/tests/test_sharing.py b/tests/test_sharing.py index 043f693..2b75eb7 100644 --- a/tests/test_sharing.py +++ b/tests/test_sharing.py @@ -297,6 +297,30 @@ def test_page_editor_renders_page_is_shared(client): assert "pageIsShared:true" in r.text +def test_tree_is_shared_includes_link_shared_pages(client): + _auth(client, user_id=1, login="owner") + from app.db import get_conn + with get_conn() as conn: + ws = conn.execute("SELECT id FROM workspaces WHERE owner_id=1 LIMIT 1").fetchone() + if not ws: + return + ws_id = ws["id"] + cur = conn.execute( + "INSERT INTO pages (workspace, title, content, content_format, parent_section, share_mode, workspace_id) " + "VALUES ('WS', 'Link Shared WS', '[]', 'blocks', 'Workspace', 'anyone', ?)", + (ws_id,), + ) + conn.commit() + pid = cur.lastrowid + + r = client.get("/api/local-workspace/tree") + assert r.status_code == 200 + items = r.json().get("children", []) + match = [c for c in items if c.get("id") == pid] + assert match, f"page {pid} not found in tree" + assert match[0]["is_shared"] is True, "link-shared page should show is_shared=true in tree" + + def get_conn_ctx(): from app.db import get_conn return get_conn() \ No newline at end of file