dy-dashboard/tests/test_spot_menu.py
2026-10-28 11:14:17 +08:00

27 lines
1.0 KiB
Python

"""现货采样管理菜单与新增页面入口回归测试。"""
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
BASE = (ROOT / 'templates/base.html').read_text(encoding='utf-8')
APP = (ROOT / 'static/js/app.js').read_text(encoding='utf-8')
SERVER = (ROOT / 'app.py').read_text(encoding='utf-8')
AUTH = (ROOT / 'routes/auth.py').read_text(encoding='utf-8')
class SpotMenuTest(unittest.TestCase):
def test_menu_names(self):
for text in ('现货采样管理', '现货数据看板', '现货销量管理', '授权资料管理'):
self.assertIn(text, BASE)
def test_authorization_page_is_registered(self):
self.assertIn('/spot/authorization', BASE)
self.assertIn("'/spot/authorization': 'spot_authorization'", APP)
self.assertIn("'spot_authorization': loadSpotAuthorizationPage", APP)
self.assertIn("'spot/authorization'", SERVER)
self.assertIn("'spot_authorization': ['spot_authorization', 'spot']", AUTH)
if __name__ == '__main__':
unittest.main()