Handling request validation/authentication

This commit is contained in:
Deluan
2016-02-24 18:06:49 -05:00
parent 9a55fa1c64
commit 975327a6cb
14 changed files with 220 additions and 14 deletions
+3 -3
View File
@@ -12,6 +12,7 @@ import (
. "github.com/smartystreets/goconvey/convey"
"fmt"
"github.com/deluan/gosonic/controllers/responses"
"github.com/deluan/gosonic/tests"
)
func init() {
@@ -20,13 +21,12 @@ func init() {
beego.TestBeegoInit(appPath)
}
// TestGet is a sample to run an endpoint test
func TestPing(t *testing.T) {
r, _ := http.NewRequest("GET", "/rest/ping.view", nil)
r, _ := http.NewRequest("GET", test.AddParams("/rest/ping.view"), nil)
w := httptest.NewRecorder()
beego.BeeApp.Handlers.ServeHTTP(w, r)
beego.Trace("testing", "TestPing", fmt.Sprintf("Code[%d]\n%s", w.Code, w.Body.String()))
beego.Trace("testing", "TestPing", fmt.Sprintf("\nUrl: %s\n\nCode[%d]\n%s", r.URL, w.Code, w.Body.String()))
Convey("Subject: Ping Endpoint\n", t, func() {
Convey("Status code should be 200", func() {