- first runnable ver.
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -0,0 +1,5 @@
|
|||||||
|
jx-callback
|
||||||
|
*.tmp
|
||||||
|
commentsRouter_*
|
||||||
|
swagger/
|
||||||
|
debug
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ runmode = dev
|
|||||||
autorender = false
|
autorender = false
|
||||||
copyrequestbody = true
|
copyrequestbody = true
|
||||||
EnableDocs = true
|
EnableDocs = true
|
||||||
|
RouterCaseSensitive = true
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"jx-callback/models"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/jx-callback/models"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -89,4 +90,3 @@ func (o *ObjectController) Delete() {
|
|||||||
o.Data["json"] = "delete success!"
|
o.Data["json"] = "delete success!"
|
||||||
o.ServeJSON()
|
o.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"jx-callback/models"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/jx-callback/models"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -116,4 +117,3 @@ func (u *UserController) Logout() {
|
|||||||
u.Data["json"] = "logout success"
|
u.Data["json"] = "logout success"
|
||||||
u.ServeJSON()
|
u.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "jx-callback/routers"
|
_ "git.rosy.net.cn/jx-callback/routers"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
package routers
|
package routers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"jx-callback/controllers"
|
"git.rosy.net.cn/jx-callback/controllers"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package test
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
|
||||||
"runtime"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
_ "jx-callback/routers"
|
"runtime"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
_ "git.rosy.net.cn/jx-callback/routers"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
@@ -14,7 +15,7 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
_, file, _, _ := runtime.Caller(1)
|
_, file, _, _ := runtime.Caller(1)
|
||||||
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator))))
|
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
|
||||||
beego.TestBeegoInit(apppath)
|
beego.TestBeegoInit(apppath)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,12 +28,11 @@ func TestGet(t *testing.T) {
|
|||||||
beego.Trace("testing", "TestGet", "Code[%d]\n%s", w.Code, w.Body.String())
|
beego.Trace("testing", "TestGet", "Code[%d]\n%s", w.Code, w.Body.String())
|
||||||
|
|
||||||
Convey("Subject: Test Station Endpoint\n", t, func() {
|
Convey("Subject: Test Station Endpoint\n", t, func() {
|
||||||
Convey("Status Code Should Be 200", func() {
|
Convey("Status Code Should Be 200", func() {
|
||||||
So(w.Code, ShouldEqual, 200)
|
So(w.Code, ShouldEqual, 200)
|
||||||
})
|
})
|
||||||
Convey("The Result Should Not Be Empty", func() {
|
Convey("The Result Should Not Be Empty", func() {
|
||||||
So(w.Body.Len(), ShouldBeGreaterThan, 0)
|
So(w.Body.Len(), ShouldBeGreaterThan, 0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user