ef4b2f17ca
P1-P4: configurable nav/section visibility in system settings, full .env editor with restart badges, password change, runtime hot overrides, and single-instance pm2 restart. Works in hub embed iframe. Co-authored-by: Cursor <cursoragent@cursor.com>
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
from lib.instance.instance_embed_lib import (
|
|
EMBED_TABS,
|
|
embed_context_extras,
|
|
include_transfer_block,
|
|
path_to_embed_tab,
|
|
rewrite_embed_dest,
|
|
ui_open_guard_enabled,
|
|
ui_orphan_recovery_enabled,
|
|
)
|
|
|
|
|
|
def test_path_to_embed_tab():
|
|
assert path_to_embed_tab("/trade") == "trade"
|
|
assert path_to_embed_tab("/key_monitor") == "key_monitor"
|
|
assert path_to_embed_tab("/strategy/records") == "strategy_records"
|
|
assert path_to_embed_tab("/unknown") is None
|
|
|
|
|
|
def test_rewrite_embed_dest():
|
|
url = rewrite_embed_dest("/trade", hub_theme="dark")
|
|
assert url.startswith("/embed?")
|
|
assert "tab=trade" in url
|
|
assert "embed=1" in url
|
|
assert "hub_theme=dark" in url
|
|
|
|
|
|
def test_embed_tabs_cover_main_nav():
|
|
assert "trade" in EMBED_TABS
|
|
assert "key_monitor" in EMBED_TABS
|
|
assert "records" in EMBED_TABS
|
|
assert "env_config" in EMBED_TABS
|
|
assert "risk_policy" in EMBED_TABS
|
|
assert "settings" in EMBED_TABS
|
|
assert path_to_embed_tab("/env_config") == "env_config"
|
|
assert path_to_embed_tab("/risk_policy") == "risk_policy"
|
|
assert path_to_embed_tab("/settings") == "settings"
|
|
|
|
|
|
def test_embed_context_extras_unified_ui_flags():
|
|
for ex in ("binance", "okx", "gate"):
|
|
assert include_transfer_block(ex) is True
|
|
assert ui_open_guard_enabled("okx") is True
|
|
assert ui_open_guard_enabled("binance") is False
|
|
assert ui_orphan_recovery_enabled("binance") is True
|
|
assert ui_orphan_recovery_enabled("gate") is False
|
|
ctx = embed_context_extras("gate")
|
|
assert ctx["order_rule_tips_tpl"] == "order_monitor_rule_tips_gate.html"
|
|
assert ctx["include_transfer_block"] is True
|