quintodrome/tests/controllers/get_music_folders_test.go

28 lines
697 B
Go
Raw Normal View History

package test
import (
"testing"
_ "github.com/deluan/gosonic/routers"
2016-02-24 14:24:06 -09:00
. "github.com/deluan/gosonic/tests"
. "github.com/smartystreets/goconvey/convey"
2016-02-24 15:14:48 -09:00
"encoding/xml"
)
func TestGetMusicFolders(t *testing.T) {
2016-02-24 14:24:06 -09:00
_, w := Get(AddParams("/rest/getMusicFolders.view"), "TestGetMusicFolders")
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)
So(w.Body.String(), ShouldContainSubstring, `musicFolder id="1" name="iTunes Library"`)
})
})
}