test(backend): update auth and employee service tests
- tests/test_auth_service.py: update auth service tests - tests/test_employee_service.py: update employee service tests
This commit is contained in:
@@ -118,6 +118,23 @@ def test_disable_employee_marks_status_and_logs_change() -> None:
|
||||
assert any(item.action == "停用员工账号" for item in updated.history)
|
||||
|
||||
|
||||
def test_enable_employee_restores_status_and_logs_change() -> None:
|
||||
with build_session() as db:
|
||||
service = EmployeeService(db)
|
||||
employee = next(item for item in service.list_employees() if item.status != "停用")
|
||||
service.disable_employee(employee.id)
|
||||
|
||||
updated = service.enable_employee(employee.id)
|
||||
|
||||
persisted = db.get(Employee, employee.id)
|
||||
|
||||
assert updated.status == "在职"
|
||||
assert updated.statusTone == "success"
|
||||
assert persisted is not None
|
||||
assert persisted.employment_status == "在职"
|
||||
assert any(item.action == "启用员工账号" for item in updated.history)
|
||||
|
||||
|
||||
def test_update_employee_rejects_invalid_date_format() -> None:
|
||||
with build_session() as db:
|
||||
service = EmployeeService(db)
|
||||
|
||||
Reference in New Issue
Block a user