feat(admin): 部门管理新增 ERP HRAO 部门一次性导入脚本

This commit is contained in:
HTEWJ\26070045 committed 2026-10-08 10:59:35 +08:00
1 parent 48fe19ed71
commit f7361905b7
6 files changed
+392 -13

No files matched your search

@@ -64,6 +64,16 @@ def test_create_department_allows_same_name_under_different_parents(app):
assert all(len([c for c in root['children'] if c['name'] == '管理部']) == 1 for root in tree)
def test_create_department_allows_same_name_root_across_companies(app):
"""分支测试意图:两家公司的顶级部门允许同名(按 company 分桶查重),同公司顶级同名仍拒绝。"""
with app.app_context():
create_department({'name': '管理部', 'company': '苏州和信'})
create_department({'name': '管理部', 'company': '泰国合欣'})
with pytest.raises(ValidationError) as exc_info:
create_department({'name': '管理部', 'company': '苏州和信'})
assert exc_info.value.code == 'DEPT.NAME_EXISTS'
def test_create_department_inherits_company_from_parent(app):
"""断言:未填公司时继承上级部门 company(公司虚拟分组依赖)。"""
with app.app_context():