First version of getAlbumList.view working.
- It still misses almost all type options - Introduced "parent" in Child subresponse, as it was breaking DSub
This commit is contained in:
@@ -84,6 +84,27 @@ func TestSubsonicResponses(t *testing.T) {
|
||||
})
|
||||
})
|
||||
|
||||
Convey("Child", func() {
|
||||
response.Directory = &Directory{Id: "1", Name: "N"}
|
||||
Convey("With all data", func() {
|
||||
child := make([]Child, 1)
|
||||
t := time.Date(2016, 03, 2, 20, 30, 0, 0, time.UTC)
|
||||
child[0] = Child{
|
||||
Id: "1", IsDir: true, Title: "title", Album: "album", Artist: "artist", Track: 1,
|
||||
Year: 1985, Genre: "Rock", CoverArt: "1", Size: "8421341", ContentType: "audio/flac",
|
||||
Suffix: "flac", TranscodedContentType: "audio/mpeg", TranscodedSuffix: "mp3",
|
||||
Duration: 146, BitRate: 320, Starred: &t,
|
||||
}
|
||||
response.Directory.Child = child
|
||||
Convey("XML", func() {
|
||||
So(response, ShouldMatchXML, `<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.0.0"><directory id="1" name="N"><child id="1" isDir="true" title="title" album="album" artist="artist" track="1" year="1985" genre="Rock" coverArt="1" size="8421341" contentType="audio/flac" suffix="flac" starred="2016-03-02T20:30:00Z" transcodedContentType="audio/mpeg" transcodedSuffix="mp3" duration="146" bitRate="320"></child></directory></subsonic-response>`)
|
||||
})
|
||||
Convey("JSON", func() {
|
||||
So(response, ShouldMatchJSON, `{"directory":{"child":[{"album":"album","artist":"artist","bitRate":320,"contentType":"audio/flac","coverArt":"1","duration":146,"genre":"Rock","id":"1","isDir":true,"size":"8421341","starred":"2016-03-02T20:30:00Z","suffix":"flac","title":"title","track":1,"transcodedContentType":"audio/mpeg","transcodedSuffix":"mp3","year":1985}],"id":"1","name":"N"},"status":"ok","version":"1.0.0"}`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Convey("Directory", func() {
|
||||
response.Directory = &Directory{Id: "1", Name: "N"}
|
||||
Convey("Without data", func() {
|
||||
@@ -105,21 +126,27 @@ func TestSubsonicResponses(t *testing.T) {
|
||||
So(response, ShouldMatchJSON, `{"directory":{"child":[{"id":"1","isDir":false,"title":"title"}],"id":"1","name":"N"},"status":"ok","version":"1.0.0"}`)
|
||||
})
|
||||
})
|
||||
Convey("With all data", func() {
|
||||
child := make([]Child, 1)
|
||||
t := time.Date(2016, 03, 2, 20, 30, 0, 0, time.UTC)
|
||||
child[0] = Child{
|
||||
Id: "1", IsDir: true, Title: "title", Album: "album", Artist: "artist", Track: 1,
|
||||
Year: 1985, Genre: "Rock", CoverArt: "1", Size: "8421341", ContentType: "audio/flac",
|
||||
Suffix: "flac", TranscodedContentType: "audio/mpeg", TranscodedSuffix: "mp3",
|
||||
Duration: 146, BitRate: 320, Starred: &t,
|
||||
}
|
||||
response.Directory.Child = child
|
||||
})
|
||||
|
||||
Convey("AlbumList", func() {
|
||||
response.AlbumList = &AlbumList{}
|
||||
Convey("Without data", func() {
|
||||
Convey("XML", func() {
|
||||
So(response, ShouldMatchXML, `<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.0.0"><directory id="1" name="N"><child id="1" isDir="true" title="title" album="album" artist="artist" track="1" year="1985" genre="Rock" coverArt="1" size="8421341" contentType="audio/flac" suffix="flac" starred="2016-03-02T20:30:00Z" transcodedContentType="audio/mpeg" transcodedSuffix="mp3" duration="146" bitRate="320"></child></directory></subsonic-response>`)
|
||||
So(response, ShouldMatchXML, `<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.0.0"><albumList></albumList></subsonic-response>`)
|
||||
})
|
||||
Convey("JSON", func() {
|
||||
So(response, ShouldMatchJSON, `{"directory":{"child":[{"album":"album","artist":"artist","bitRate":320,"contentType":"audio/flac","coverArt":"1","duration":146,"genre":"Rock","id":"1","isDir":true,"size":"8421341","starred":"2016-03-02T20:30:00Z","suffix":"flac","title":"title","track":1,"transcodedContentType":"audio/mpeg","transcodedSuffix":"mp3","year":1985}],"id":"1","name":"N"},"status":"ok","version":"1.0.0"}`)
|
||||
So(response, ShouldMatchJSON, `{"albumList":{},"status":"ok","version":"1.0.0"}`)
|
||||
})
|
||||
})
|
||||
Convey("With just required data", func() {
|
||||
child := make([]Child, 1)
|
||||
child[0] = Child{Id: "1", Title: "title", IsDir: false}
|
||||
response.AlbumList.Album = child
|
||||
Convey("XML", func() {
|
||||
So(response, ShouldMatchXML, `<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.0.0"><albumList><album id="1" isDir="false" title="title"></album></albumList></subsonic-response>`)
|
||||
})
|
||||
Convey("JSON", func() {
|
||||
So(response, ShouldMatchJSON, `{"albumList":{"album":[{"id":"1","isDir":false,"title":"title"}]},"status":"ok","version":"1.0.0"}`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user