Files
ewoooc/tests/test_external_tool_entrypoints.py
OoO 6086f2e0f7
All checks were successful
CD Pipeline / deploy (push) Successful in 1m3s
移除資料協作入口錯站文案
2026-05-19 11:10:01 +08:00

46 lines
1.9 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_metabase_and_grist_navigation_stays_inside_momo_pro():
app_source = (ROOT / "app.py").read_text(encoding="utf-8")
shell = (ROOT / "templates/components/_ewoooc_shell.html").read_text(encoding="utf-8")
tabs = (ROOT / "templates/components/_analysis_report_tabs.html").read_text(encoding="utf-8")
legacy_nav = (ROOT / "templates/components/_navbar.html").read_text(encoding="utf-8")
assert "'metabase_url': '/metabase'" in app_source
assert "'grist_url': '/grist'" in app_source
assert "['sales', 'daily_sales', 'monthly', 'growth', 'metabase', 'grist']" in shell
combined = "\n".join([app_source, shell, tabs, legacy_nav])
assert "grist.wooo.work" not in combined
assert "awoooi" not in combined.lower()
def test_external_tool_bridge_pages_are_diagnostic_not_blank():
route_source = (ROOT / "routes/system_public_routes.py").read_text(encoding="utf-8")
template = (ROOT / "templates/external_tool_status.html").read_text(encoding="utf-8")
css = (ROOT / "web/static/css/page-external-tools.css").read_text(encoding="utf-8")
assert "def _external_tool_payload(kind)" in route_source
assert "parsed.path.rstrip('/') == bridge_path.rstrip('/')" in route_source
assert "external-tool-checks" in template
assert "external-tool-diagnostics" in template
assert "external-tool-action-grid" in template
assert "尚未接入 proxy" in route_source
assert "已由入口攔截" in route_source
assert "AwoooI" not in route_source
assert "--momo-accent-rust" not in css
assert "--momo-accent-honey" not in css
def test_analysis_tabs_use_internal_tool_labels_without_external_icon():
tabs = (ROOT / "templates/components/_analysis_report_tabs.html").read_text(encoding="utf-8")
assert "自訂圖表" in tabs
assert "資料協作" in tabs
assert "fa-up-right-from-square" not in tabs