Tests refactored
This commit is contained in:
@@ -1,33 +1,15 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"runtime"
|
||||
"path/filepath"
|
||||
_ "github.com/deluan/gosonic/routers"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
. "github.com/deluan/gosonic/tests"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"github.com/deluan/gosonic/tests"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, file, _, _ := runtime.Caller(1)
|
||||
appPath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, "../.." + string(filepath.Separator))))
|
||||
beego.TestBeegoInit(appPath)
|
||||
}
|
||||
|
||||
// TestGet is a sample to run an endpoint test
|
||||
func TestGetLicense(t *testing.T) {
|
||||
r, _ := http.NewRequest("GET", test.AddParams("/rest/getLicense.view"), nil)
|
||||
w := httptest.NewRecorder()
|
||||
beego.BeeApp.Handlers.ServeHTTP(w, r)
|
||||
|
||||
beego.Trace("testing", "TestGetLicense", fmt.Sprintf("Code[%d]\n%s", w.Code, w.Body.String()))
|
||||
_, w := Get(AddParams("/rest/getLicense.view"), "TestGetLicense")
|
||||
|
||||
Convey("Subject: GetLicense Endpoint\n", t, func() {
|
||||
Convey("Status code should be 200", func() {
|
||||
|
||||
Reference in New Issue
Block a user