Show job progress steps in web UI
This commit is contained in:
@@ -6,6 +6,8 @@ import sys
|
||||
|
||||
import web_app
|
||||
from web_app import (
|
||||
DubJob,
|
||||
_job_progress,
|
||||
_stage_uploaded_cookies,
|
||||
build_pipeline_command,
|
||||
create_app,
|
||||
@@ -123,3 +125,27 @@ def test_stage_uploaded_cookies_rejects_unsupported_extension(tmp_path):
|
||||
assert "Expected one of" in str(exc)
|
||||
else:
|
||||
raise AssertionError("Expected ValueError for unsupported cookie upload")
|
||||
|
||||
|
||||
def test_job_progress_tracks_pipeline_steps(tmp_path):
|
||||
log_path = tmp_path / "job.log"
|
||||
log_path.write_text("STEP 1: PREPARING CONTENT\nSTEP 2: SPEECH TRANSCRIPTION\n", encoding="utf-8")
|
||||
job = DubJob(id="demo", command=[], log_path=log_path, status="running")
|
||||
|
||||
progress, steps_html = _job_progress(job)
|
||||
|
||||
assert progress == 25
|
||||
assert "[done]" in steps_html
|
||||
assert "[active]" in steps_html
|
||||
assert "Speech transcription" in steps_html
|
||||
|
||||
|
||||
def test_job_progress_marks_succeeded_complete(tmp_path):
|
||||
log_path = tmp_path / "job.log"
|
||||
log_path.write_text("", encoding="utf-8")
|
||||
job = DubJob(id="demo", command=[], log_path=log_path, status="succeeded")
|
||||
|
||||
progress, steps_html = _job_progress(job)
|
||||
|
||||
assert progress == 100
|
||||
assert "[todo]" not in steps_html
|
||||
|
||||
Reference in New Issue
Block a user