feat: 移除 CSV 和 Markdown 导出
This commit is contained in:
@@ -4,7 +4,7 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def test_user_guide_covers_startup_acceptance_exports_and_troubleshooting():
|
||||
def test_user_guide_covers_startup_acceptance_no_exports_and_troubleshooting():
|
||||
content = (ROOT / "docs" / "UserGuide.md").read_text(encoding="utf-8")
|
||||
|
||||
for required in [
|
||||
@@ -12,7 +12,9 @@ def test_user_guide_covers_startup_acceptance_exports_and_troubleshooting():
|
||||
"http://localhost:8000",
|
||||
"1 × 1 × 10",
|
||||
"5 × 5 × 50",
|
||||
"导出文件",
|
||||
"文件导出",
|
||||
"已关闭 CSV / Markdown 文件下载入口和接口",
|
||||
"页面不展示 CSV / Markdown 下载入口",
|
||||
"8000 端口被占用",
|
||||
"API Key 缺失",
|
||||
"任务长期 running",
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
from app.services.export_service import labels_to_text, safe_csv_field, safe_filename
|
||||
|
||||
|
||||
def test_labels_to_text_joins_json_array_with_chinese_comma():
|
||||
assert labels_to_text('["认可", "质量好"]') == "认可,质量好"
|
||||
assert labels_to_text("bad-json") == ""
|
||||
|
||||
|
||||
def test_safe_csv_field_prevents_formula_injection_and_newlines():
|
||||
assert safe_csv_field("=1+1") == "'=1+1"
|
||||
assert safe_csv_field("+1+1") == "'+1+1"
|
||||
assert safe_csv_field("-1+1") == "'-1+1"
|
||||
assert safe_csv_field("@SUM(1,1)") == "'@SUM(1,1)"
|
||||
assert safe_csv_field("hello\nworld") == "hello world"
|
||||
assert safe_csv_field("hello\r\nworld") == "hello world"
|
||||
assert safe_csv_field("hello\rworld") == "hello world"
|
||||
|
||||
|
||||
def test_safe_filename_replaces_illegal_chars_and_truncates_keyword():
|
||||
filename = safe_filename("douyin", "task", "a/b:c*d?e<f>g|很长很长很长很长很长")
|
||||
|
||||
assert "/" not in filename
|
||||
assert "__" not in filename
|
||||
assert filename.endswith(".csv")
|
||||
Reference in New Issue
Block a user