test(regulatory-info-package): 覆盖材料包主链路
This commit is contained in:
48
tests/test_regulatory_info_package_template_config.py
Normal file
48
tests/test_regulatory_info_package_template_config.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from review_agent.regulatory_info_package.constants import DEFAULT_ZIP_NAME
|
||||
from review_agent.regulatory_info_package.services.template_config import (
|
||||
compute_config_hash,
|
||||
load_template_config,
|
||||
validate_template_config,
|
||||
)
|
||||
|
||||
|
||||
def test_template_config_loads_seven_templates():
|
||||
config = load_template_config()
|
||||
|
||||
assert config["version"] == "regulatory_info_package_templates_v1"
|
||||
assert config["zip_name"] == DEFAULT_ZIP_NAME
|
||||
assert len(config["templates"]) == 7
|
||||
assert {template["code"] for template in config["templates"]} == {
|
||||
"ch1_2_directory",
|
||||
"ch1_4_application_form",
|
||||
"ch1_5_product_list",
|
||||
"ch1_9_pre_submission",
|
||||
"ch1_11_1_standards",
|
||||
"ch1_11_5_authenticity",
|
||||
"ch1_11_6_conformity",
|
||||
}
|
||||
assert validate_template_config(config) == []
|
||||
assert compute_config_hash()
|
||||
|
||||
|
||||
def test_template_config_rejects_duplicate_codes():
|
||||
config = load_template_config()
|
||||
config["templates"].append(dict(config["templates"][0]))
|
||||
|
||||
errors = validate_template_config(config)
|
||||
|
||||
assert any("重复" in error for error in errors)
|
||||
|
||||
|
||||
def test_template_config_sources_exist():
|
||||
config = load_template_config()
|
||||
source_dir = Path(config["source_dir"])
|
||||
|
||||
assert source_dir.exists()
|
||||
for template in config["templates"]:
|
||||
assert (source_dir / template["source_file"]).exists()
|
||||
|
||||
Reference in New Issue
Block a user