对接中控:只读持仓快照 API、SSO 打开链与 iframe 祖先配置。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""中控 Bridge SSO / Token 冒烟."""
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from lib.hub.hub_bridge_auth import (
|
||||
make_sso_token,
|
||||
verify_sso_token,
|
||||
build_embed_open_url,
|
||||
)
|
||||
|
||||
|
||||
class HubBridgeAuthTests(unittest.TestCase):
|
||||
def test_sso_roundtrip(self):
|
||||
tok = make_sso_token("secret-token", ttl_sec=60)
|
||||
self.assertTrue(verify_sso_token(tok, "secret-token"))
|
||||
self.assertFalse(verify_sso_token(tok, "other"))
|
||||
self.assertFalse(verify_sso_token("bad", "secret-token"))
|
||||
|
||||
def test_embed_open_url(self):
|
||||
url = build_embed_open_url(
|
||||
"https://okx.example.com",
|
||||
bridge_token="abc",
|
||||
embed_path="/embed",
|
||||
)
|
||||
self.assertTrue(url.startswith("https://okx.example.com/hub_sso?"))
|
||||
self.assertIn("token=", url)
|
||||
self.assertIn("next=%2Fembed", url)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user