From d3ff2dae984f9a13a1f36b6658d7e00284f0211d Mon Sep 17 00:00:00 2001 From: tech Date: Tue, 21 Apr 2026 23:07:29 +0800 Subject: [PATCH] fix: update integration test, remove unused import, fix stale comment Co-Authored-By: Claude Opus 4.7 --- tests/test_backup.py | 4 +--- tests/test_integration.py | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/test_backup.py b/tests/test_backup.py index dadedd4..7e39a84 100644 --- a/tests/test_backup.py +++ b/tests/test_backup.py @@ -1,6 +1,4 @@ from datetime import datetime, timezone -from pathlib import Path - from order_bak.csv_utils import write_csv from order_bak.backup import backup_orders @@ -33,7 +31,7 @@ def test_backup_filters_by_state_and_date(tmp_path): _make_entity("u1", "o1", datetime(2025, 1, 1, 10, tzinfo=timezone.utc), 1), _make_entity("u2", "o2", datetime(2025, 1, 1, 12, tzinfo=timezone.utc), 0), # Payed, skip _make_entity("u3", "o3", datetime(2025, 1, 2, 8, tzinfo=timezone.utc), 1), - _make_entity("u4", "o4", datetime(2025, 1, 3, 8, tzinfo=timezone.utc), 1), # outside range + _make_entity("u4", "o4", datetime(2025, 1, 3, 8, tzinfo=timezone.utc), 1), # at cutoff, skip ] scan_csv = scan_dir / "scan-2025-01-03.csv" write_csv(scan_csv, entities) diff --git a/tests/test_integration.py b/tests/test_integration.py index 4dd2c78..76b8c45 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -123,13 +123,12 @@ def test_full_pipeline(table_client, tmp_path): scan_rows = list(read_csv(scan_path)) assert len(scan_rows) == len(orders) # all orders, no filtering - # --- Backup (Jan 1-2 only) --- + # --- Backup (before Jan 3) --- backup_dir = tmp_path / "backups" count = backup_orders( scan_path=scan_path, backup_dir=backup_dir, - start=datetime(2025, 1, 1, tzinfo=timezone.utc), - end=datetime(2025, 1, 3, tzinfo=timezone.utc), + cutoff=datetime(2025, 1, 3, tzinfo=timezone.utc), ) # 2 days × 2 users × 2 Recived = 8 orders assert count == 8