feat: add week 3 audio and timeline enhancements
This commit is contained in:
@@ -256,6 +256,53 @@ class TestAudio:
|
||||
assert detail["generation_status"] == "partial_ready"
|
||||
assert detail["last_error"] is None
|
||||
|
||||
status_response = auth_client.get(f"/api/audio/{test_story.id}/status")
|
||||
assert status_response.status_code == 200
|
||||
status_data = status_response.json()
|
||||
assert status_data["audio_ready"] is True
|
||||
assert status_data["cache_exists"] is True
|
||||
assert status_data["cache_size_bytes"] == len(b"fake-audio-bytes")
|
||||
assert status_data["cache_updated_at"] is not None
|
||||
assert status_data["audio_status"] == "ready"
|
||||
|
||||
def test_audio_status_does_not_generate_audio(
|
||||
self,
|
||||
auth_client: TestClient,
|
||||
test_story,
|
||||
mock_tts_provider,
|
||||
):
|
||||
response = auth_client.get(f"/api/audio/{test_story.id}/status")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["audio_ready"] is False
|
||||
assert data["cache_exists"] is False
|
||||
assert data["audio_status"] == "not_requested"
|
||||
assert "audio" in data["retryable_assets"]
|
||||
mock_tts_provider.assert_not_awaited()
|
||||
|
||||
def test_delete_audio_cache_makes_audio_retryable(
|
||||
self,
|
||||
auth_client: TestClient,
|
||||
test_story,
|
||||
mock_tts_provider,
|
||||
):
|
||||
response = auth_client.get(f"/api/audio/{test_story.id}")
|
||||
assert response.status_code == 200
|
||||
|
||||
cached_audio_path = Path(settings.story_audio_cache_dir) / f"story-{test_story.id}.mp3"
|
||||
assert cached_audio_path.is_file()
|
||||
|
||||
response = auth_client.delete(f"/api/audio/{test_story.id}/cache")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["audio_ready"] is False
|
||||
assert data["cache_exists"] is False
|
||||
assert data["audio_status"] == "not_requested"
|
||||
assert "audio" in data["retryable_assets"]
|
||||
assert not cached_audio_path.exists()
|
||||
|
||||
def test_get_audio_regenerates_when_cache_file_is_missing(
|
||||
self,
|
||||
auth_client: TestClient,
|
||||
|
||||
Reference in New Issue
Block a user