fix: move declaration to after runtime flags for positional compat
DouyinVideoUploadRequest dataclass 声明字段位置
被独立审查者(deleg_61d33c80)标记为P1兼容问题:
旧位置调用 ('scheduled', False, False) 会被错位解析。
把 declaration 移到最后,保留旧位置契约。
Previous-Review: deleg_61d33c80
Ref: dreammis/social-auto-upload#213(安全后续修正)
This commit is contained in:
+1
-1
@@ -63,10 +63,10 @@ class DouyinVideoUploadRequest:
|
|||||||
thumbnail_portrait_file: Path | None = None
|
thumbnail_portrait_file: Path | None = None
|
||||||
product_link: str = ""
|
product_link: str = ""
|
||||||
product_title: str = ""
|
product_title: str = ""
|
||||||
declaration: str | None = None
|
|
||||||
publish_strategy: str = DOUYIN_PUBLISH_STRATEGY_IMMEDIATE
|
publish_strategy: str = DOUYIN_PUBLISH_STRATEGY_IMMEDIATE
|
||||||
debug: bool = True
|
debug: bool = True
|
||||||
headless: bool = True
|
headless: bool = True
|
||||||
|
declaration: str | None = None
|
||||||
|
|
||||||
|
|
||||||
@dataclass(slots=True)
|
@dataclass(slots=True)
|
||||||
|
|||||||
@@ -90,6 +90,16 @@ class BrowserCliParserTests(unittest.TestCase):
|
|||||||
])
|
])
|
||||||
self.assertIsNone(args.declaration)
|
self.assertIsNone(args.declaration)
|
||||||
|
|
||||||
|
def test_douyin_request_legacy_positional_runtime_flags_keep_their_meaning(self):
|
||||||
|
request = sau_cli.DouyinVideoUploadRequest(
|
||||||
|
"creator", Path("demo.mp4"), "标题", "简介", [], 0,
|
||||||
|
None, None, None, "", "", "scheduled", False, False,
|
||||||
|
)
|
||||||
|
self.assertEqual(request.publish_strategy, "scheduled")
|
||||||
|
self.assertFalse(request.debug)
|
||||||
|
self.assertFalse(request.headless)
|
||||||
|
self.assertIsNone(request.declaration)
|
||||||
|
|
||||||
def test_tencent_upload_video_accepts_dual_thumbnail_aspects(self):
|
def test_tencent_upload_video_accepts_dual_thumbnail_aspects(self):
|
||||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||||
video_path = Path(tmp_dir) / "demo.mp4"
|
video_path = Path(tmp_dir) / "demo.mp4"
|
||||||
|
|||||||
Reference in New Issue
Block a user