fix(tencent): wire collection name into uploader
This commit is contained in:
@@ -201,6 +201,25 @@ class BrowserCliParserTests(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class BrowserCliDispatchTests(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):
|
def test_dispatch_xiaohongshu_check_prints_valid(self):
|
||||||
args = Namespace(platform="xiaohongshu", action="check", account="creator")
|
args = Namespace(platform="xiaohongshu", action="check", account="creator")
|
||||||
with patch("sau_cli.check_xiaohongshu_account", new=AsyncMock(return_value=True)):
|
with patch("sau_cli.check_xiaohongshu_account", new=AsyncMock(return_value=True)):
|
||||||
|
|||||||
@@ -498,12 +498,14 @@ class TencentBaseUploader(BaseVideoUploader):
|
|||||||
publish_strategy: str = TENCENT_PUBLISH_STRATEGY_IMMEDIATE,
|
publish_strategy: str = TENCENT_PUBLISH_STRATEGY_IMMEDIATE,
|
||||||
debug: bool = DEBUG_MODE,
|
debug: bool = DEBUG_MODE,
|
||||||
headless: bool = LOCAL_CHROME_HEADLESS,
|
headless: bool = LOCAL_CHROME_HEADLESS,
|
||||||
|
collection_name: str | None = None,
|
||||||
):
|
):
|
||||||
self.publish_date = publish_date
|
self.publish_date = publish_date
|
||||||
self.account_file = _resolve_account_file(account_file)
|
self.account_file = _resolve_account_file(account_file)
|
||||||
self.publish_strategy = publish_strategy
|
self.publish_strategy = publish_strategy
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
self.headless = headless
|
self.headless = headless
|
||||||
|
self.collection_name = collection_name
|
||||||
self.local_executable_path = LOCAL_CHROME_PATH
|
self.local_executable_path = LOCAL_CHROME_PATH
|
||||||
|
|
||||||
async def validate_base_args(self):
|
async def validate_base_args(self):
|
||||||
@@ -953,6 +955,7 @@ class TencentVideo(TencentBaseUploader):
|
|||||||
publish_strategy: str = TENCENT_PUBLISH_STRATEGY_IMMEDIATE,
|
publish_strategy: str = TENCENT_PUBLISH_STRATEGY_IMMEDIATE,
|
||||||
debug: bool = DEBUG_MODE,
|
debug: bool = DEBUG_MODE,
|
||||||
headless: bool = LOCAL_CHROME_HEADLESS,
|
headless: bool = LOCAL_CHROME_HEADLESS,
|
||||||
|
collection_name: str | None = None,
|
||||||
):
|
):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
publish_date=publish_date,
|
publish_date=publish_date,
|
||||||
@@ -960,6 +963,7 @@ class TencentVideo(TencentBaseUploader):
|
|||||||
publish_strategy=publish_strategy,
|
publish_strategy=publish_strategy,
|
||||||
debug=debug,
|
debug=debug,
|
||||||
headless=headless,
|
headless=headless,
|
||||||
|
collection_name=collection_name,
|
||||||
)
|
)
|
||||||
self.title = title
|
self.title = title
|
||||||
self.file_path = file_path
|
self.file_path = file_path
|
||||||
|
|||||||
Reference in New Issue
Block a user