test: invented artists, albums and MusicBrainz ids in place of real ones
release / web (push) Failing after 1m16s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m0s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped

Test data and example comments named real artists, records and songs, and
carried real MusicBrainz ids. One mapping swaps them for invented ones
throughout (Fields of Ontario, Plastic Apes, Marlo Davies, ...), keeping
what each case tests: sort order, index letter, escaping, title keys,
artist-prefix stripping. A test username is no longer the operator's name.

The cover-art and Last.fm connection checks still query real releases;
they reach live services and need something that exists there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 13:21:34 -05:00
co-authored by Claude Opus 5.5
parent 4244d81dfd
commit 4e1807cbba
80 changed files with 570 additions and 570 deletions
+25 -25
View File
@@ -59,9 +59,9 @@ func injectFakeUserForTest(next http.Handler) http.Handler {
func TestHandleGetTrack_HappyPath(t *testing.T) {
h, pool := testHandlers(t)
truncateLibrary(t, pool)
artist := seedArtist(t, pool, "Beatles")
album := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969)
track := seedTrack(t, pool, album.ID, artist.ID, "Something", 3, 183_000)
artist := seedArtist(t, pool, "Copper Lanterns")
album := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969)
track := seedTrack(t, pool, album.ID, artist.ID, "Somewhere Near", 3, 183_000)
req := httptest.NewRequest(http.MethodGet, "/api/tracks/"+uuidToString(track.ID), nil)
w := httptest.NewRecorder()
@@ -74,7 +74,7 @@ func TestHandleGetTrack_HappyPath(t *testing.T) {
if err := json.Unmarshal(w.Body.Bytes(), &got); err != nil {
t.Fatalf("decode: %v body=%s", err, w.Body.String())
}
if got.Title != "Something" || got.AlbumTitle != "Abbey Road" || got.ArtistName != "Beatles" {
if got.Title != "Somewhere Near" || got.AlbumTitle != "Harbour Street" || got.ArtistName != "Copper Lanterns" {
t.Errorf("ref = %+v", got)
}
if got.TrackNumber != 3 || got.DurationSec != 183 {
@@ -111,10 +111,10 @@ func TestHandleGetTrack_NotFound(t *testing.T) {
func TestHandleGetAlbum_HappyPath(t *testing.T) {
h, pool := testHandlers(t)
truncateLibrary(t, pool)
artist := seedArtist(t, pool, "Beatles")
album := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969)
seedTrack(t, pool, album.ID, artist.ID, "Come Together", 1, 259_000)
seedTrack(t, pool, album.ID, artist.ID, "Something", 2, 183_000)
artist := seedArtist(t, pool, "Copper Lanterns")
album := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969)
seedTrack(t, pool, album.ID, artist.ID, "Come Along", 1, 259_000)
seedTrack(t, pool, album.ID, artist.ID, "Somewhere Near", 2, 183_000)
req := httptest.NewRequest(http.MethodGet, "/api/albums/"+uuidToString(album.ID), nil)
w := httptest.NewRecorder()
@@ -127,13 +127,13 @@ func TestHandleGetAlbum_HappyPath(t *testing.T) {
if err := json.Unmarshal(w.Body.Bytes(), &got); err != nil {
t.Fatalf("decode: %v body=%s", err, w.Body.String())
}
if got.Title != "Abbey Road" || got.ArtistName != "Beatles" || got.Year != 1969 {
if got.Title != "Harbour Street" || got.ArtistName != "Copper Lanterns" || got.Year != 1969 {
t.Errorf("album = %+v", got)
}
if len(got.Tracks) != 2 {
t.Fatalf("tracks len = %d, want 2", len(got.Tracks))
}
if got.Tracks[0].Title != "Come Together" || got.Tracks[1].Title != "Something" {
if got.Tracks[0].Title != "Come Along" || got.Tracks[1].Title != "Somewhere Near" {
t.Errorf("tracks = %+v", got.Tracks)
}
if got.TrackCount != 2 || got.DurationSec != 442 { // 259 + 183
@@ -180,7 +180,7 @@ func TestHandleGetAlbum_EachTrackNamesItsOwnArtist(t *testing.T) {
func TestHandleGetAlbum_NoTracks(t *testing.T) {
h, pool := testHandlers(t)
truncateLibrary(t, pool)
artist := seedArtist(t, pool, "Beatles")
artist := seedArtist(t, pool, "Copper Lanterns")
album := seedAlbum(t, pool, artist.ID, "Empty", 0)
req := httptest.NewRequest(http.MethodGet, "/api/albums/"+uuidToString(album.ID), nil)
@@ -230,11 +230,11 @@ func TestHandleGetAlbum_NotFound(t *testing.T) {
func TestHandleGetArtist_HappyPath(t *testing.T) {
h, pool := testHandlers(t)
truncateLibrary(t, pool)
artist := seedArtist(t, pool, "Beatles")
album1 := seedAlbum(t, pool, artist.ID, "Abbey Road", 1969)
album2 := seedAlbum(t, pool, artist.ID, "Let It Be", 1970)
seedTrack(t, pool, album1.ID, artist.ID, "Something", 3, 183_000)
seedTrack(t, pool, album2.ID, artist.ID, "Get Back", 1, 189_000)
artist := seedArtist(t, pool, "Copper Lanterns")
album1 := seedAlbum(t, pool, artist.ID, "Harbour Street", 1969)
album2 := seedAlbum(t, pool, artist.ID, "Let It Ride", 1970)
seedTrack(t, pool, album1.ID, artist.ID, "Somewhere Near", 3, 183_000)
seedTrack(t, pool, album2.ID, artist.ID, "Get Going", 1, 189_000)
req := httptest.NewRequest(http.MethodGet, "/api/artists/"+uuidToString(artist.ID), nil)
w := httptest.NewRecorder()
@@ -247,7 +247,7 @@ func TestHandleGetArtist_HappyPath(t *testing.T) {
if err := json.Unmarshal(w.Body.Bytes(), &got); err != nil {
t.Fatalf("decode: %v body=%s", err, w.Body.String())
}
if got.Name != "Beatles" {
if got.Name != "Copper Lanterns" {
t.Errorf("name = %q", got.Name)
}
if got.AlbumCount != 2 {
@@ -256,13 +256,13 @@ func TestHandleGetArtist_HappyPath(t *testing.T) {
if len(got.Albums) != 2 {
t.Fatalf("albums len = %d, want 2", len(got.Albums))
}
// ListAlbumsByArtist orders by release_date then sort_title; Abbey Road
// ListAlbumsByArtist orders by release_date then sort_title; Harbour Street
// (1969) first.
if got.Albums[0].Title != "Abbey Road" {
t.Errorf("first album = %q, want Abbey Road", got.Albums[0].Title)
if got.Albums[0].Title != "Harbour Street" {
t.Errorf("first album = %q, want Harbour Street", got.Albums[0].Title)
}
for _, a := range got.Albums {
if a.ArtistName != "Beatles" {
if a.ArtistName != "Copper Lanterns" {
t.Errorf("album.artist_name = %q", a.ArtistName)
}
if a.CoverURL == "" {
@@ -321,9 +321,9 @@ func TestHandleGetArtist_NotFound(t *testing.T) {
func TestHandleListArtists_DefaultAlpha(t *testing.T) {
h, pool := testHandlers(t)
truncateLibrary(t, pool)
seedArtist(t, pool, "Beatles")
seedArtist(t, pool, "ABBA")
seedArtist(t, pool, "Zeppelin")
seedArtist(t, pool, "Copper Lanterns")
seedArtist(t, pool, "ABAB")
seedArtist(t, pool, "Zephyrine")
req := httptest.NewRequest(http.MethodGet, "/api/artists", nil)
w := httptest.NewRecorder()
@@ -345,7 +345,7 @@ func TestHandleListArtists_DefaultAlpha(t *testing.T) {
if len(got.Items) != 3 {
t.Fatalf("items len = %d", len(got.Items))
}
if got.Items[0].Name != "ABBA" || got.Items[2].Name != "Zeppelin" {
if got.Items[0].Name != "ABAB" || got.Items[2].Name != "Zephyrine" {
t.Errorf("alpha order wrong: %q, %q, %q", got.Items[0].Name, got.Items[1].Name, got.Items[2].Name)
}
}