diff --git a/tests/test_sau_browser_cli.py b/tests/test_sau_browser_cli.py index 4da58c6..7655500 100644 --- a/tests/test_sau_browser_cli.py +++ b/tests/test_sau_browser_cli.py @@ -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)): diff --git a/uploader/tencent_uploader/main.py b/uploader/tencent_uploader/main.py index c94572f..de1fc96 100644 --- a/uploader/tencent_uploader/main.py +++ b/uploader/tencent_uploader/main.py @@ -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