57 lines
1.7 KiB
Python
57 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def test_analyze_dump_finds_and_clones_fixture(tmp_path: Path) -> None:
|
|
fixture = tmp_path / "coach.json"
|
|
fixture.write_text(
|
|
json.dumps(
|
|
{
|
|
"date": "2026-06-16",
|
|
"workout": {
|
|
"workoutName": "Coach Ride",
|
|
"sportType": {"sportTypeKey": "cycling"},
|
|
"estimatedDurationInSecs": 60,
|
|
"workoutSegments": [
|
|
{
|
|
"sportType": {"sportTypeKey": "cycling"},
|
|
"workoutSteps": [
|
|
{
|
|
"type": "ExecutableStepDTO",
|
|
"stepType": {"stepTypeKey": "warmup"},
|
|
"endCondition": {"conditionTypeKey": "time"},
|
|
"endConditionValue": 60,
|
|
"targetType": {"workoutTargetTypeKey": "no.target"},
|
|
}
|
|
],
|
|
}
|
|
],
|
|
},
|
|
}
|
|
),
|
|
encoding="utf-8",
|
|
)
|
|
|
|
result = subprocess.run(
|
|
[
|
|
sys.executable,
|
|
"scripts/analyze_dump.py",
|
|
str(fixture),
|
|
"--date",
|
|
"2026-06-16",
|
|
"--clone-dry-run",
|
|
],
|
|
text=True,
|
|
capture_output=True,
|
|
check=False,
|
|
)
|
|
|
|
assert result.returncode == 0
|
|
assert "Local clone payload passed validation." in result.stdout
|
|
assert "GCClone 2026-06-16 Coach Ride" in result.stdout
|
|
|