Better tests organization

This commit is contained in:
Deluan
2016-02-27 18:42:08 -05:00
parent ecc0df9e7c
commit ce240cfeff
8 changed files with 54 additions and 35 deletions
+27
View File
@@ -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"`)
})
})
}