Initial wiring for getPlaylists endpoint
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
package responses_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/deluan/gosonic/api/responses"
|
||||
. "github.com/deluan/gosonic/tests"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestSubsonicResponses(t *testing.T) {
|
||||
@@ -172,6 +173,31 @@ func TestSubsonicResponses(t *testing.T) {
|
||||
})
|
||||
})
|
||||
})
|
||||
Convey("Playlists", func() {
|
||||
response.Playlists = &Playlists{}
|
||||
|
||||
Convey("Without data", func() {
|
||||
Convey("XML", func() {
|
||||
So(response, ShouldMatchXML, `<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.0.0"><playlists></playlists></subsonic-response>`)
|
||||
})
|
||||
Convey("JSON", func() {
|
||||
So(response, ShouldMatchJSON, `{"playlists":{},"status":"ok","version":"1.0.0"}`)
|
||||
})
|
||||
})
|
||||
Convey("With data", func() {
|
||||
pls := make([]Playlist, 2)
|
||||
pls[0] = Playlist{Id: "111", Name: "aaa"}
|
||||
pls[1] = Playlist{Id: "222", Name: "bbb"}
|
||||
response.Playlists.Playlist = pls
|
||||
|
||||
Convey("XML", func() {
|
||||
So(response, ShouldMatchXML, `<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.0.0"><playlists><playlist id="111" name="aaa"></playlist><playlist id="222" name="bbb"></playlist></playlists></subsonic-response>`)
|
||||
})
|
||||
Convey("JSON", func() {
|
||||
So(response, ShouldMatchJSON, `{"playlists":{"playlist":[{"id":"111","name":"aaa"},{"id":"222","name":"bbb"}]},"status":"ok","version":"1.0.0"}`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reset(func() {
|
||||
response = &Subsonic{Status: "ok", Version: "1.0.0"}
|
||||
|
||||
Reference in New Issue
Block a user