fix(fulfillment): 仅同步已映射订单

This commit is contained in:
yml
2026-11-18 12:05:28 +08:00
parent 509a6eecb3
commit 27da489b79
4 changed files with 171 additions and 42 deletions
+17
View File
@@ -148,6 +148,10 @@ class TestUrlNormalization:
url = "postgresql://u:p@h:5432/db"
assert src._normalize_url(url) == "postgresql+psycopg://u:p@h:5432/db"
def test_bare_postgres_url_gets_driver(self):
url = "postgres://u:p@h:5432/db"
assert src._normalize_url(url) == "postgresql+psycopg://u:p@h:5432/db"
def test_url_with_driver_is_untouched(self):
url = "postgresql+psycopg://u:p@h:5432/db"
assert src._normalize_url(url) == url
@@ -171,6 +175,19 @@ class TestDegradation:
with pytest.raises(src.OrderLookupUnavailable):
src.lookup_order(" ")
def test_empty_pending_sku_filter_skips_external_lookup(self, monkeypatch):
monkeypatch.setenv("ORDER_SITE_DATABASE_URL", "postgresql://u:p@h:5432/db")
monkeypatch.setenv("ORDER_SITE_LOOKUP_ENABLED", "true")
monkeypatch.setattr(
src,
"_get_engine",
lambda: (_ for _ in ()).throw(
AssertionError("没有 SKU 白名单时不应连接 order_site")
),
)
assert src.list_pending_manual_fulfillments(internal_sku_keys=[]) == []
class TestCacheRoundTrip:
"""缓存读写:命中未过期快照就不查外部。"""