feat: feature enforcement imports (#37/#38) and Universal CSV validation (#71)
Activity and nutrition legacy CSV imports enforce tier limits with UsageBadge UI; Universal CSV gets mapping validation on copy/import, format-check parity, and structured error_details. version: 0.9u module: activity 1.2.1, nutrition 1.0.3, csv_import 0.4.0 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
532e17c4cd
commit
79ec249bc3
27 files changed
+690
-95
No files matched your search
@@ -0,0 +1,26 @@
|
||||
"""Tests für CSV-Vorlagen-Validierung (#71)."""
|
||||
|
||||
from csv_parser.template_validator import validate_csv_template
|
||||
|
||||
|
||||
def test_validate_csv_template_rejects_invalid_row_processing():
|
||||
report = validate_csv_template(
|
||||
"nutrition",
|
||||
{"Datum": "date", "kcal": "kcal"},
|
||||
None,
|
||||
{"group_by": ["date"], "aggregates": {"kcal": "not_an_op"}},
|
||||
["Datum", "kcal"],
|
||||
)
|
||||
assert report["valid"] is False
|
||||
assert any(e.get("code") == "invalid_import_row_processing" for e in report["errors"])
|
||||
|
||||
|
||||
def test_validate_csv_template_accepts_nutrition_aggregation():
|
||||
report = validate_csv_template(
|
||||
"nutrition",
|
||||
{"Datum": "date", "kcal": "kcal", "protein": "protein_g"},
|
||||
None,
|
||||
{"group_by": ["date"], "aggregates": {"kcal": "sum", "protein_g": "sum"}},
|
||||
["Datum", "kcal", "protein"],
|
||||
)
|
||||
assert report["valid"] is True
|
||||
Reference in new issue
Block a user