Files
periscope/tests/test_periscope_project_delete_ui.py
T
michele 7a32c552bb Stamp 2.60.0 incomplete PCB exam and owner project delete.
Partial layouts still use MODE=pcb. Missing copper is INSUFFICIENT or
skipped, never Euclidean stand-in tracks. Via≠Pad unchanged. DELETE
/api/projects/{id} is owner-only with a dashboard confirm dialog.
2026-09-20 21:17:26 +02:00

66 lines
1.5 KiB
Python

"""Dashboard owner delete uses a confirm dialog, not window.confirm."""
from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
BTN = (
ROOT
/ "periscope"
/ "src"
/ "frontend"
/ "src"
/ "components"
/ "dashboard"
/ "delete-project-button.tsx"
)
CARD = (
ROOT
/ "periscope"
/ "src"
/ "frontend"
/ "src"
/ "components"
/ "dashboard"
/ "project-card.tsx"
)
TABLE = (
ROOT
/ "periscope"
/ "src"
/ "frontend"
/ "src"
/ "components"
/ "dashboard"
/ "projects-table.tsx"
)
API = ROOT / "periscope" / "src" / "frontend" / "src" / "lib" / "api.ts"
def test_delete_dialog_is_src_and_owner_only_copy():
text = BTN.read_text(encoding="utf-8")
assert "Native Periscope overlay" not in text[:400]
assert "export function DeleteProjectButton" in text
assert "AlertDialog" in text
assert "deleteProject" in text
assert "window.confirm" not in text
assert "confirm(`" not in text
def test_dashboard_cards_and_table_use_delete_dialog():
card = CARD.read_text(encoding="utf-8")
table = TABLE.read_text(encoding="utf-8")
assert "DeleteProjectButton" in card
assert "DeleteProjectButton" in table
assert "confirm(" not in card
assert "confirm(" not in table
assert "!foreign" in card
assert "!foreign" in table
def test_api_delete_is_http_delete():
text = API.read_text(encoding="utf-8")
assert "export async function deleteProject" in text
assert 'method: "DELETE"' in text