mirror of
https://github.com/beego/bee.git
synced 2024-11-24 13:30:53 +00:00
Merge pull request #23 from ljyf5593/master
fixed tests code cannot convert ".." to type rune
This commit is contained in:
commit
47379b40a0
14
apiapp.go
14
apiapp.go
@ -40,11 +40,11 @@ In the appname folder has the follow struct:
|
|||||||
├── routers
|
├── routers
|
||||||
│ └── router.go
|
│ └── router.go
|
||||||
├── tests
|
├── tests
|
||||||
│ └── default_test.go
|
│ └── default_test.go
|
||||||
├── main.go
|
├── main.go
|
||||||
└── models
|
└── models
|
||||||
└── object.go
|
└── object.go
|
||||||
└── user.go
|
└── user.go
|
||||||
|
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
@ -471,14 +471,14 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
_ "{{.Appname}}/routers"
|
_ "{{.Appname}}/routers"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
_, file, _, _ := runtime.Caller(1)
|
_, file, _, _ := runtime.Caller(1)
|
||||||
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + filepath.Separator)))
|
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator))))
|
||||||
beego.TestBeegoInit(apppath)
|
beego.TestBeegoInit(apppath)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,9 +487,9 @@ func TestGet(t *testing.T) {
|
|||||||
r, _ := http.NewRequest("GET", "/object", nil)
|
r, _ := http.NewRequest("GET", "/object", nil)
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
beego.BeeApp.Handlers.ServeHTTP(w, r)
|
beego.BeeApp.Handlers.ServeHTTP(w, r)
|
||||||
|
|
||||||
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)
|
||||||
|
18
new.go
18
new.go
@ -38,15 +38,15 @@ The [appname] folder has following structure:
|
|||||||
|- default.go
|
|- default.go
|
||||||
|- models
|
|- models
|
||||||
|- routers
|
|- routers
|
||||||
|- router.go
|
|- router.go
|
||||||
|- tests
|
|- tests
|
||||||
|- default_test.go
|
|- default_test.go
|
||||||
|- static
|
|- static
|
||||||
|- js
|
|- js
|
||||||
|- css
|
|- css
|
||||||
|- img
|
|- img
|
||||||
|- views
|
|- views
|
||||||
index.tpl
|
index.tpl
|
||||||
|
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
@ -179,14 +179,14 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
_ "{{.Appname}}/routers"
|
_ "{{.Appname}}/routers"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
_, file, _, _ := runtime.Caller(1)
|
_, file, _, _ := runtime.Caller(1)
|
||||||
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + filepath.Separator)))
|
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator))))
|
||||||
beego.TestBeegoInit(apppath)
|
beego.TestBeegoInit(apppath)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,9 +196,9 @@ func TestMain(t *testing.T) {
|
|||||||
r, _ := http.NewRequest("GET", "/", nil)
|
r, _ := http.NewRequest("GET", "/", nil)
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
beego.BeeApp.Handlers.ServeHTTP(w, r)
|
beego.BeeApp.Handlers.ServeHTTP(w, r)
|
||||||
|
|
||||||
beego.Trace("testing", "TestMain", "Code[%d]\n%s", w.Code, w.Body.String())
|
beego.Trace("testing", "TestMain", "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)
|
||||||
@ -234,7 +234,7 @@ var indextpl = `<!DOCTYPE html>
|
|||||||
<head>
|
<head>
|
||||||
<title>Beego</title>
|
<title>Beego</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
@ -290,7 +290,7 @@ var indextpl = `<!DOCTYPE html>
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<header class="hero-unit" style="background-color:#A9F16C">
|
<header class="hero-unit" style="background-color:#A9F16C">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
Loading…
Reference in New Issue
Block a user