mirror of
https://github.com/navidrome/navidrome.git
synced 2024-09-10 11:32:48 +02:00
32 lines
737 B
Go
32 lines
737 B
Go
package api_test
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"github.com/deluan/gosonic/api/responses"
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
"testing"
|
|
"github.com/deluan/gosonic/tests"
|
|
)
|
|
|
|
func TestPing(t *testing.T) {
|
|
tests.Init(t, false)
|
|
|
|
_, w := Get(AddParams("/rest/ping.view"), "TestPing")
|
|
|
|
Convey("Subject: Ping Endpoint", t, func() {
|
|
Convey("Status code should be 200", func() {
|
|
So(w.Code, ShouldEqual, 200)
|
|
})
|
|
Convey("The result should not be empty", func() {
|
|
So(w.Body.Len(), ShouldBeGreaterThan, 0)
|
|
})
|
|
Convey("The result should be a valid ping response", func() {
|
|
v := responses.Subsonic{}
|
|
xml.Unmarshal(w.Body.Bytes(), &v)
|
|
So(v.Status, ShouldEqual, "ok")
|
|
So(v.Version, ShouldEqual, "1.0.0")
|
|
})
|
|
|
|
})
|
|
}
|