39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
"""权限配置页面布局样式回归检查。"""
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
APP = (ROOT / 'static' / 'js' / 'app.js').read_text(encoding='utf-8')
|
|
CSS = (ROOT / 'static' / 'css' / 'style.css').read_text(encoding='utf-8')
|
|
|
|
|
|
class PermissionLayoutTest(unittest.TestCase):
|
|
def test_main_permission_layout_classes_exist(self):
|
|
for name in (
|
|
'perm-role-panel', 'perm-role-grid', 'perm-role-card',
|
|
'perm-user-toolbar', 'perm-user-grid', 'perm-user-card',
|
|
):
|
|
self.assertIn(name, APP)
|
|
self.assertIn('.' + name, CSS)
|
|
|
|
def test_permission_matrix_uses_aligned_operation_and_field_sections(self):
|
|
self.assertIn('perm-config-page-name', APP)
|
|
self.assertIn('perm-operation-list', APP)
|
|
self.assertIn('perm-field-section', APP)
|
|
self.assertIn('grid-template-columns: 170px minmax(0, 1fr)', CSS)
|
|
self.assertIn('grid-column: 1 / -1', CSS)
|
|
|
|
def test_permission_dialogs_share_consistent_shell(self):
|
|
self.assertIn('perm-dialog perm-role-dialog', APP)
|
|
self.assertIn('perm-dialog perm-user-dialog', APP)
|
|
self.assertIn('.perm-dialog-header', CSS)
|
|
self.assertIn('.perm-dialog-footer', CSS)
|
|
|
|
def test_each_known_role_has_own_user_section(self):
|
|
for role in ('procurement_planner', 'procurement_follower', 'product_developer', 'operator'):
|
|
self.assertIn("{role: '" + role + "'", APP)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|