feat(music-lab): POST /pipeline에 compile_job_id + visual_style/background 옵션
This commit is contained in:
@@ -108,3 +108,69 @@ def test_youtube_status_when_disconnected(client):
|
||||
r = client.get("/api/music/youtube/status")
|
||||
assert r.status_code == 200
|
||||
assert r.json() == {"connected": False}
|
||||
|
||||
|
||||
def test_create_pipeline_with_compile_job(client, monkeypatch):
|
||||
import sqlite3
|
||||
conn = sqlite3.connect(db.DB_PATH)
|
||||
cur = conn.cursor()
|
||||
try:
|
||||
cur.execute("""
|
||||
INSERT INTO compile_jobs (title, track_ids_json, crossfade_sec,
|
||||
audio_path, status, created_at)
|
||||
VALUES ('Test Mix', '[1,2,3]', 3, '/app/data/compiles/9.mp3',
|
||||
'succeeded', datetime())
|
||||
""")
|
||||
except sqlite3.OperationalError:
|
||||
pytest.skip("compile_jobs schema mismatch")
|
||||
conn.commit()
|
||||
cid = cur.lastrowid
|
||||
conn.close()
|
||||
|
||||
r = client.post("/api/music/pipeline", json={"compile_job_id": cid})
|
||||
assert r.status_code == 201
|
||||
body = r.json()
|
||||
assert body["track_id"] is None
|
||||
assert body["compile_job_id"] == cid
|
||||
assert body["visual_style"] == "essential"
|
||||
|
||||
|
||||
def test_create_pipeline_rejects_both_inputs(client):
|
||||
r = client.post("/api/music/pipeline", json={"track_id": 1, "compile_job_id": 1})
|
||||
assert r.status_code == 400
|
||||
|
||||
|
||||
def test_create_pipeline_rejects_neither(client):
|
||||
r = client.post("/api/music/pipeline", json={})
|
||||
assert r.status_code == 400
|
||||
|
||||
|
||||
def test_create_pipeline_rejects_compile_not_ready(client):
|
||||
import sqlite3
|
||||
conn = sqlite3.connect(db.DB_PATH)
|
||||
cur = conn.cursor()
|
||||
try:
|
||||
cur.execute("""
|
||||
INSERT INTO compile_jobs (title, status, created_at)
|
||||
VALUES ('Pending', 'rendering', datetime())
|
||||
""")
|
||||
except sqlite3.OperationalError:
|
||||
pytest.skip("compile_jobs schema mismatch")
|
||||
conn.commit()
|
||||
cid = cur.lastrowid
|
||||
conn.close()
|
||||
|
||||
r = client.post("/api/music/pipeline", json={"compile_job_id": cid})
|
||||
assert r.status_code == 400
|
||||
|
||||
|
||||
def test_create_pipeline_with_visual_options(client):
|
||||
r = client.post("/api/music/pipeline", json={
|
||||
"track_id": 1, "visual_style": "single",
|
||||
"background_mode": "video_loop", "background_keyword": "rain",
|
||||
})
|
||||
assert r.status_code == 201
|
||||
body = r.json()
|
||||
assert body["visual_style"] == "single"
|
||||
assert body["background_mode"] == "video_loop"
|
||||
assert body["background_keyword"] == "rain"
|
||||
|
||||
Reference in New Issue
Block a user