fix(tencent): wire collection name into uploader

This commit is contained in:
home-dev-pookz
2026-08-20 04:21:03 +08:00
parent 9dc3cdb6d0
commit 926be742cd
2 changed files with 23 additions and 0 deletions
+19
View File
@@ -201,6 +201,25 @@ class BrowserCliParserTests(unittest.TestCase):
class BrowserCliDispatchTests(unittest.TestCase):
def test_upload_tencent_video_forwards_collection_name_to_uploader(self):
request = sau_cli.TencentVideoUploadRequest(
account_name="creator",
video_file=Path("demo.mp4"),
title="视频标题",
description="视频简介",
tags=["测试"],
publish_date=0,
collection_name="我的合集",
)
with (
patch("sau_cli.tencent_setup", new=AsyncMock(return_value=True)),
patch.object(sau_cli.TencentVideo, "tencent_upload_video", new=AsyncMock()) as mock_upload,
):
asyncio.run(sau_cli.upload_tencent_video(request))
mock_upload.assert_awaited_once()
def test_dispatch_xiaohongshu_check_prints_valid(self):
args = Namespace(platform="xiaohongshu", action="check", account="creator")
with patch("sau_cli.check_xiaohongshu_account", new=AsyncMock(return_value=True)):
+4
View File
@@ -498,12 +498,14 @@ class TencentBaseUploader(BaseVideoUploader):
publish_strategy: str = TENCENT_PUBLISH_STRATEGY_IMMEDIATE,
debug: bool = DEBUG_MODE,
headless: bool = LOCAL_CHROME_HEADLESS,
collection_name: str | None = None,
):
self.publish_date = publish_date
self.account_file = _resolve_account_file(account_file)
self.publish_strategy = publish_strategy
self.debug = debug
self.headless = headless
self.collection_name = collection_name
self.local_executable_path = LOCAL_CHROME_PATH
async def validate_base_args(self):
@@ -953,6 +955,7 @@ class TencentVideo(TencentBaseUploader):
publish_strategy: str = TENCENT_PUBLISH_STRATEGY_IMMEDIATE,
debug: bool = DEBUG_MODE,
headless: bool = LOCAL_CHROME_HEADLESS,
collection_name: str | None = None,
):
super().__init__(
publish_date=publish_date,
@@ -960,6 +963,7 @@ class TencentVideo(TencentBaseUploader):
publish_strategy=publish_strategy,
debug=debug,
headless=headless,
collection_name=collection_name,
)
self.title = title
self.file_path = file_path