mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-12 22:42:13 +02:00
fix(podcasts): keep legacy episodes readable and guard regenerate
This commit is contained in:
parent
aa7f14d94f
commit
ca9b157676
4 changed files with 66 additions and 9 deletions
|
|
@ -13,7 +13,7 @@ from __future__ import annotations
|
|||
|
||||
import pytest
|
||||
|
||||
from app.podcasts.persistence import PodcastStatus
|
||||
from app.podcasts.persistence import Podcast, PodcastStatus
|
||||
from app.podcasts.service import PodcastService
|
||||
|
||||
from .conftest import build_transcript
|
||||
|
|
@ -179,3 +179,24 @@ async def test_revert_when_nothing_was_regenerated_is_rejected(
|
|||
resp = await client.post(f"{BASE}/{podcast.id}/regenerate/revert")
|
||||
|
||||
assert resp.status_code == 409
|
||||
|
||||
|
||||
async def test_regenerate_without_a_brief_is_rejected(
|
||||
client, db_session, db_search_space, captured_tasks
|
||||
):
|
||||
# Legacy episodes finished before briefs existed; reopening a gate with
|
||||
# nothing to review would strand them there.
|
||||
podcast = Podcast(
|
||||
title="Legacy Episode",
|
||||
search_space_id=db_search_space.id,
|
||||
status=PodcastStatus.READY,
|
||||
spec_version=1,
|
||||
file_location="/var/old/podcast.mp3",
|
||||
)
|
||||
db_session.add(podcast)
|
||||
await db_session.flush()
|
||||
|
||||
resp = await client.post(f"{BASE}/{podcast.id}/transcript/regenerate")
|
||||
|
||||
assert resp.status_code == 422
|
||||
assert captured_tasks.draft == []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue