guanghu-ice-heart/runtime/fifth-domain-language-system/tests/test_enterprise_language_master_bridge.py

34 lines
1.6 KiB
Python
Raw Normal View History

import json
from pathlib import Path
import unittest
REPO_ROOT = Path(__file__).resolve().parents[3]
class EnterpriseLanguageMasterBridgeTests(unittest.TestCase):
def setUp(self):
self.route = json.loads((REPO_ROOT / "routing/fifth-domain-enterprise-language-master-bridge.json").read_text())
def test_route_has_exact_separate_human_paths(self):
self.assertEqual(self.route["repository_id"], "REPO-016")
self.assertEqual(self.route["source"]["channel"], "ICE-CH-ZC001")
self.assertFalse(self.route["bingshuo_entry"]["direct_enterprise_human_login_required"])
self.assertFalse(self.route["team_entry"]["server_os_login"])
self.assertTrue(self.route["team_entry"]["temporary_password_must_change"])
def test_no_secret_material_is_registered(self):
text = json.dumps(self.route, ensure_ascii=False).lower()
self.assertNotIn("password=", text)
self.assertNotIn("token=", text)
self.assertNotIn("authorization:", text)
self.assertEqual(self.route["bingshuo_entry"]["credential_location"], "JD_FD_PRIMARY_ROOT_ONLY_NOT_PUBLIC")
def test_repository_number_is_unique(self):
registry = json.loads((REPO_ROOT / "routing/lighthouse-path-registry.json").read_text())
self.assertEqual(sum(1 for item in registry["paths"] if item["id"] == "REPO-016"), 1)
repositories = json.loads((REPO_ROOT / "routing/repository-route-map.json").read_text())["repositories"]
self.assertEqual(sum(1 for item in repositories if item["code"] == "REPO-016"), 1)
if __name__ == "__main__":
unittest.main()