chore: [workflow] 提交工作区代码

This commit is contained in:
wangyunlong committed 2026-09-30 10:46:15 +08:00
1 parent 2ff588a65d
commit 01f3d7aaf7
131 files changed
+24306 -1320

No files matched your search

@@ -11,6 +11,7 @@ import collect_jd_persona_to_bitable as jd_worker
import collect_persona_to_bitable as tm_worker
import dy_audience_profile_collect as dy_collector
import pytest
import run_daily_persona as persona_launcher
import taobao_dmp_item_crowd_insight_screenshots as dmp
from gyxx_flow.adapters import acceptance_policy
@@ -315,6 +316,15 @@ def test_dy_persistent_profile_is_not_overwritten_by_exported_cookies() -> None:
}
def test_dy_account_profile_receives_vault_cookies_without_sharing_profile() -> None:
cookies = [{"name": "session", "value": "new", "domain": ".jinritemai.com"}]
assert dy_collector.account_profile_launch_options("bound-profile", cookies) == {
"user_data_dir": "bound-profile",
"cookies": cookies,
}
def test_dy_profileless_fallback_can_restore_exported_cookies() -> None:
cookies = [{"name": "session", "value": "new", "domain": ".jinritemai.com"}]
@@ -397,3 +407,48 @@ def test_jd_persona_login_home_navigation_does_not_wait_for_networkidle() -> Non
assert 'wait_until="networkidle"' not in home_block[:400]
assert 'wait_until="domcontentloaded"' in home_block[:400]
assert "timeout=60_000" in home_block[:400]
@pytest.mark.parametrize(
("url", "expected"),
(
(
"https://sz.jd.com/szweb/sz/view/productAnalysis/productDetail.html",
True,
),
(
"https://jdsz.jd.com/szweb/view/product/productDetail.html",
True,
),
("https://passport.jd.com/new/login.aspx?ReturnUrl=productDetail", False),
("https://sz.jd.com/sz/view/notAuthorized.html", False),
("https://example.com/szweb/view/product/productDetail.html", False),
),
)
def test_jd_product_detail_route_accepts_vendor_redirect_only(
url: str,
expected: bool,
) -> None:
assert jd_worker._is_jd_product_detail_url(url) is expected
def test_persona_launcher_can_select_failed_platforms_and_styles() -> None:
assert persona_launcher.selected_platforms("dy,jd,dy") == ["dy", "jd"]
assert persona_launcher.selected_platforms("") == ["tm", "dy", "jd"]
assert persona_launcher.build_child_command(
"collector.py",
BUSINESS_DATE,
"布谷,白鹭,蓝鹊",
) == [
sys.executable,
"collector.py",
"--date",
"2026-08-04",
"--styles",
"布谷,白鹭,蓝鹊",
]
def test_persona_launcher_rejects_unknown_platform() -> None:
with pytest.raises(ValueError, match="不支持的平台"):
persona_launcher.selected_platforms("tm,unknown")