feat(fulfillment): 增加订单匹配起算时间

This commit is contained in:
yml
2026-11-18 12:32:04 +08:00
parent 79da819384
commit 0d57c615c9
14 changed files with 338 additions and 48 deletions
+28
View File
@@ -188,6 +188,34 @@ class TestDegradation:
assert src.list_pending_manual_fulfillments(internal_sku_keys=[]) == []
def test_pending_lookup_passes_paid_at_cutoff(self, monkeypatch):
monkeypatch.setenv("ORDER_SITE_DATABASE_URL", "postgresql://u:p@h:5432/db")
monkeypatch.setenv("ORDER_SITE_LOOKUP_ENABLED", "true")
cutoff = datetime(2026, 11, 18, 12, 0, tzinfo=UTC)
captured: dict[str, object] = {}
def _rows(*, limit, internal_sku_keys, paid_at_from):
captured.update(
{
"limit": limit,
"internal_sku_keys": internal_sku_keys,
"paid_at_from": paid_at_from,
}
)
return []
monkeypatch.setattr(src, "_fetch_pending_manual_fulfillments", _rows)
assert (
src.list_pending_manual_fulfillments(
limit=20,
internal_sku_keys=["兔兔白日梦头盔"],
paid_at_from=cutoff,
)
== []
)
assert captured["paid_at_from"] == cutoff
class TestCacheRoundTrip:
"""缓存读写:命中未过期快照就不查外部。"""