修复证书导入模板识别与文件重选
This commit is contained in:
@@ -20,6 +20,7 @@ from app.api.routes.admin_imports import (
|
||||
TEMPLATE_HEADERS,
|
||||
build_import_template_workbook,
|
||||
date_is_valid,
|
||||
detect_template_from_workbook,
|
||||
normalize_row_data,
|
||||
parse_issue_date,
|
||||
row_errors,
|
||||
@@ -50,6 +51,16 @@ def test_normalize_row_data_removes_time_from_excel_dates():
|
||||
assert row[COL_ISSUE_DATE] == "2026-07-05"
|
||||
|
||||
|
||||
def test_detect_template_from_workbook_uses_excel_headers(tmp_path):
|
||||
source_path = tmp_path / "practice-camp.xlsx"
|
||||
build_import_template_workbook("practice-camp").save(source_path)
|
||||
|
||||
detected = detect_template_from_workbook(source_path)
|
||||
|
||||
assert detected is not None
|
||||
assert detected.code == "practice-camp"
|
||||
|
||||
|
||||
def test_row_errors_require_project_code_to_exist():
|
||||
row = {
|
||||
COL_NAME: "张三",
|
||||
|
||||
Reference in New Issue
Block a user