fix(wiki): proxy topology through public gateway
Co-Authored-By: OpenAI Codex <codex@openai.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
||||
DEMO_PATH = PROJECT_ROOT / "data" / "wiki" / "guanghan_topology_demo.html"
|
||||
GHC05_PATH = PROJECT_ROOT / "data" / "wiki" / "guanghan_ghc05_zh.html"
|
||||
|
||||
|
||||
class WikiTopologyProxyTests(unittest.TestCase):
|
||||
def test_demo_derives_api_prefix_from_document_url(self):
|
||||
html = DEMO_PATH.read_text(encoding="utf-8")
|
||||
|
||||
self.assertIn("new URL('.', window.location.href).pathname", html)
|
||||
self.assertIn("replace(/\\/$/, '')", html)
|
||||
|
||||
def test_ghc05_embed_uses_public_proxy_instead_of_private_backend(self):
|
||||
html = GHC05_PATH.read_text(encoding="utf-8")
|
||||
public_url = (
|
||||
"http://118.89.192.134:59100/topology/"
|
||||
"guanghan_topology_demo.html?mission=GHC-05"
|
||||
)
|
||||
|
||||
self.assertEqual(html.count(public_url), 2)
|
||||
self.assertNotIn("192.168.195.241:38080", html)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user