feat: add session-level publish and comment flow
This commit is contained in:
@ -465,6 +465,35 @@ class ApiServerTests(unittest.TestCase):
|
||||
self.assertEqual(body["id"], "task-new")
|
||||
self.assertEqual(body["source_path"], source_path)
|
||||
|
||||
def test_post_tasks_creates_task_from_bilibili_url(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
source_url = "https://www.bilibili.com/video/BV1TEST1234"
|
||||
created_task = Task(
|
||||
id="task-bv",
|
||||
source_type="bilibili_url",
|
||||
source_path=str(Path(tmpdir) / "session" / "task-bv" / "task-bv.mp4"),
|
||||
title="video-title",
|
||||
status="created",
|
||||
created_at="2026-01-01T00:00:00+00:00",
|
||||
updated_at="2026-01-01T00:00:00+00:00",
|
||||
)
|
||||
ingest_service = SimpleNamespace(create_task_from_url=lambda url, settings: created_task)
|
||||
repo = FakeRepo(created_task)
|
||||
state = self._state(tmpdir, repo, ingest_service=ingest_service)
|
||||
state["settings"]["ingest"] = {"provider": "bilibili_url", "yt_dlp_cmd": "yt-dlp"}
|
||||
|
||||
response_status, _, body = self._request(
|
||||
"POST",
|
||||
"/tasks",
|
||||
state,
|
||||
body=json.dumps({"source_type": "bilibili_url", "source_url": source_url}).encode("utf-8"),
|
||||
headers={"Content-Type": "application/json"},
|
||||
)
|
||||
|
||||
self.assertEqual(response_status, 201)
|
||||
self.assertEqual(body["id"], "task-bv")
|
||||
self.assertEqual(body["source_type"], "bilibili_url")
|
||||
|
||||
def test_post_run_task_action_returns_accepted_payload(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
task = Task(
|
||||
|
||||
Reference in New Issue
Block a user