2016-02-25 08:41:34 -09:00
|
|
|
package api_test
|
2016-02-24 11:29:19 -09:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
_ "github.com/deluan/gosonic/routers"
|
2016-02-24 14:24:06 -09:00
|
|
|
. "github.com/deluan/gosonic/tests"
|
2016-02-24 11:29:19 -09:00
|
|
|
|
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
2016-02-24 15:14:48 -09:00
|
|
|
"encoding/xml"
|
2016-02-24 11:29:19 -09:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestGetMusicFolders(t *testing.T) {
|
2016-02-24 14:24:06 -09:00
|
|
|
_, w := Get(AddParams("/rest/getMusicFolders.view"), "TestGetMusicFolders")
|
2016-02-24 11:29:19 -09:00
|
|
|
|
|
|
|
|
Convey("Subject: GetMusicFolders Endpoint\n", t, func() {
|
|
|
|
|
Convey("Status code should be 200", func() {
|
|
|
|
|
So(w.Code, ShouldEqual, 200)
|
|
|
|
|
})
|
2016-02-24 15:14:48 -09:00
|
|
|
Convey("The response should include the default folder", func() {
|
|
|
|
|
v := new(string)
|
|
|
|
|
err := xml.Unmarshal(w.Body.Bytes(), &v)
|
|
|
|
|
So(err, ShouldBeNil)
|
2016-02-24 15:35:58 -09:00
|
|
|
So(w.Body.String(), ShouldContainSubstring, `musicFolder id="0" name="iTunes Library"`)
|
2016-02-24 15:14:48 -09:00
|
|
|
})
|
2016-02-24 11:29:19 -09:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|