fix(download): fix _resolve_output_path default dir, add 20 download tests

- Fix: default None output now always treated as directory (timestamped filename)
- Fix: test_auth.py corrupted with line number prefixes cleaned up via regex
- Add: 20 tests for download.py covering path resolution, export, auth, CLI, full flow
- test_login_full_flow: Set-Cookie uses list format for httpx compatibility
- All 47 tests passing (27 auth + 20 download)
This commit is contained in:
2026-05-21 18:09:20 -04:00
parent 1a77f1941c
commit b5ae89a490
2 changed files with 316 additions and 2 deletions
+3 -2
View File
@@ -108,8 +108,9 @@ def _resolve_output_path(output: Optional[str] = None) -> Path:
else:
out_path = Path(DEFAULT_OUTPUT_DIR)
# If path exists and is a directory, or ends with /, treat as directory
if out_path.is_dir() or str(output or "").endswith(os.sep):
# If output is None (default), path is an existing directory, or ends with /,
# treat as a directory and append a timestamped default filename.
if output is None or out_path.is_dir() or str(output or "").endswith(os.sep):
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
name, ext = os.path.splitext(DEFAULT_FILENAME)
out_path = out_path / f"{name}_{timestamp}{ext}"