test: ajout test tree is_shared pour pages partagées par lien
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user