test(clips): cover the raised target_clips ceiling
All checks were successful
CI / unit (pull_request) Successful in 53s
CI / backend-e2e (pull_request) Successful in 1m25s
CI / dashboard-e2e (pull_request) Successful in 2m38s

Update the out-of-range assertion to the new band and add a positive
case proving 31 queues the CLIP_TARGET_MIN/MAX override while 32 is
still rejected.
This commit is contained in:
pedro-bento 2026-10-11 21:10:05 +01:00
parent 87ccc3fa59
commit 963c3fb7c1

View file

@ -261,7 +261,29 @@ async def test_target_clips_validation(client, media_factory):
{"file": ("clip.mp4", media_factory.six.read_bytes(), "video/mp4")}, {"file": ("clip.mp4", media_factory.six.read_bytes(), "video/mp4")},
) )
assert out_of_range.status_code == 400 assert out_of_range.status_code == 400
assert "target_clips must be between 1 and 15" in out_of_range.json()["detail"] assert "target_clips must be between 1 and 31" in out_of_range.json()["detail"]
async def test_target_clips_accepts_raised_ceiling(
client, app_state, media_factory):
# The ceiling was raised from 15 to 31; the top of the new band must queue
# with the override the selector reads, and 32 must still be rejected.
resp = await _submit_file(
client,
{"acknowledged": "true", "target_clips": "31"},
{"file": ("clip.mp4", media_factory.six.read_bytes(), "video/mp4")},
)
job_id = _job(client, resp)
env = app_state.app.jobs[job_id]["env"]
assert env["CLIP_TARGET_MIN"] == "31" and env["CLIP_TARGET_MAX"] == "31"
too_many = await _submit_file(
client,
{"acknowledged": "true", "target_clips": "32"},
{"file": ("clip.mp4", media_factory.six.read_bytes(), "video/mp4")},
)
assert too_many.status_code == 400
assert "target_clips must be between 1 and 31" in too_many.json()["detail"]
async def test_clip_range_validation(client, media_factory): async def test_clip_range_validation(client, media_factory):