feat: add client compatibility endpoints and a smoke test script

- getMusicDirectory for folder/album browsing
- server-side play queues with savePlayQueue/getPlayQueue and index variants
- jukebox status and internet radio compatibility responses
- scripts/smoke.sh generates a tagged MP3 library, runs the server and
  verifies all endpoints clients use, including Range, download and covers
This commit is contained in:
TapTap committed 2026-11-13 12:40:00 +00:00
1 parent 46266d8071
commit 4d313a2846
9 files changed
+474

No files matched your search

@@ -335,6 +335,35 @@ class BrowsingRoutesTest {
}
}
@Test
fun `music directory and play queue expose folders albums and songs`() {
seededContext().use { seed ->
testApplication {
setupApp(seed)
val auth = credentials("alice", "alice-pw")
val folder = parseBody(
client.get("/rest/getMusicDirectory?$auth&id=1").bodyAsText(),
)["directory"]!!.jsonObject
val folderChildren = folder["child"]!!.jsonArray
assertEquals(1, folderChildren.size)
assertEquals(seed.aliceAlbumId, folderChildren[0].jsonObject["id"]!!.jsonPrimitive.content)
assertEquals("true", folderChildren[0].jsonObject["isDir"]!!.jsonPrimitive.content)
val album = parseBody(
client.get("/rest/getMusicDirectory?$auth&id=${seed.aliceAlbumId}").bodyAsText(),
)["directory"]!!.jsonObject
assertEquals(seed.aliceSongId, album["child"]!!.jsonArray[0].jsonObject["id"]!!.jsonPrimitive.content)
client.get("/rest/savePlayQueue?$auth&id=${seed.aliceSongId}&position=1000")
val queue = parseBody(client.get("/rest/getPlayQueue?$auth").bodyAsText())["playQueue"]!!
.jsonObject
assertEquals(seed.aliceSongId, queue["entry"]!!.jsonArray[0].jsonObject["id"]!!.jsonPrimitive.content)
assertEquals(1000, queue["position"]!!.jsonPrimitive.int)
}
}
}
@Test
fun `lyrics endpoint returns an empty structure when the song has no lyrics`() {
seededContext().use { seed ->
@@ -136,6 +136,20 @@ class SystemRoutesTest {
assertEquals(10, missing["error"]!!.jsonObject["code"]!!.jsonPrimitive.int)
}
@Test
fun `jukebox and internet radio endpoints return valid empty responses`() = testApplication {
setupApp()
val jukebox = parse(client.get("/rest/jukeboxControl?${credentials()}&action=status").bodyAsText())
assertEquals("false", jukebox["jukeboxStatus"]!!.jsonObject["playing"]!!.jsonPrimitive.content)
val radio = parse(client.get("/rest/getInternetRadioStations?${credentials()}").bodyAsText())
assertEquals(
0,
radio["internetRadioStations"]!!.jsonObject["internetRadioStation"]!!.jsonArray.size,
)
}
@Test
fun `getUsers is admin only`() = testApplication {
setupApp()