File size: 2,189 Bytes
ea9092c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544e3ba
ea9092c
 
544e3ba
ea9092c
 
 
 
544e3ba
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""Unified Studio v0.9: project library, explicit source selection and UI assets."""
from fastapi.testclient import TestClient
from app.server import create_app


def test_library_project_search_and_rename(tmp_path):
    app = create_app(tmp_path / "data")
    with TestClient(app) as client:
        assert client.get("/api/v1/projects").json() == {"projects": []}
        p = client.post("/api/v1/projects", json={"name": "Kick Session"})
        assert p.status_code == 201
        pid = p.json()["id"]
        items = client.get("/api/v1/projects").json()["projects"]
        assert len(items) == 1
        assert items[0]["id"] == pid
        assert items[0]["name"] == "Kick Session"
        assert items[0]["asset"] is None
        assert items[0]["stem_count"] == 0
        renamed = client.patch(f"/api/v1/projects/{pid}", json={"name": "Studio Session"})
        assert renamed.status_code == 200
        assert client.get(f"/api/v1/projects/{pid}").json()["name"] == "Studio Session"
        assert client.patch(f"/api/v1/projects/{pid}", json={"name": "   "}).status_code == 422
        assert client.get("/api/v1/projects").json()["projects"][0]["name"] == "Studio Session"


def test_unified_studio_delivery(tmp_path):
    app = create_app(tmp_path / "data")
    with TestClient(app) as client:
        home = client.get("/")
        assert home.status_code == 200
        assert "MULTITRACK SIGNAL MONITOR" in home.text
        assert 'id="projectList"' in home.text
        assert 'id="trackList"' in home.text
        assert 'id="noiseDetails"' in home.text
        assert "app.js" not in home.text
        assert "arrangement.js" not in home.text
        assert client.get("/static/studio.js").status_code == 200
        assert client.get("/static/studio.css").status_code == 200
        assert 'href="/static/studio-v1.css"' in home.text
        assert client.get("/static/studio-v1.css").status_code == 200
        photo = client.get("/static/studio-room.jpg")
        assert photo.status_code == 200
        assert photo.headers["content-type"].startswith("image/jpeg")
        assert 'id="libraryClose"' in home.text
        assert 'id="group-separate"' in home.text