Better tests organization
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package api_test
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"testing"
|
||||
"github.com/deluan/gosonic/tests"
|
||||
)
|
||||
|
||||
func TestGetLicense(t *testing.T) {
|
||||
tests.Init(t, false)
|
||||
|
||||
_, w := Get(AddParams("/rest/getLicense.view"), "TestGetLicense")
|
||||
|
||||
Convey("Subject: GetLicense Endpoint\n", t, func() {
|
||||
Convey("Status code should be 200", func() {
|
||||
So(w.Code, ShouldEqual, 200)
|
||||
})
|
||||
Convey("The license should always be valid", func() {
|
||||
v := new(string)
|
||||
err := xml.Unmarshal(w.Body.Bytes(), &v)
|
||||
So(err, ShouldBeNil)
|
||||
So(w.Body.String(), ShouldContainSubstring, `license valid="true"`)
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user