diff --git a/conf/app.conf b/conf/app.conf index dc17569..ecd174b 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -1,3 +1,3 @@ -appname = devops +appname = go_ops httpport = 8080 runmode = dev diff --git a/go.mod b/go.mod index b3f5f6b..e2712d9 100644 --- a/go.mod +++ b/go.mod @@ -3,4 +3,8 @@ module go_ops go 1.15 require github.com/astaxie/beego v1.12.1 -require github.com/smartystreets/goconvey v1.6.4 + +require ( + github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect + github.com/smartystreets/goconvey v1.6.4 +) diff --git a/main.go b/main.go index 7a4552a..0c3133e 100644 --- a/main.go +++ b/main.go @@ -1,11 +1,10 @@ package main import ( - _ "devops/routers" "github.com/astaxie/beego" + _ "go_ops/routers" ) func main() { beego.Run() } - diff --git a/routers/router.go b/routers/router.go index 5c23260..a0121d8 100644 --- a/routers/router.go +++ b/routers/router.go @@ -1,10 +1,10 @@ package routers import ( - "devops/controllers" "github.com/astaxie/beego" + "go_ops/controllers" ) func init() { - beego.Router("/", &controllers.MainController{}) + beego.Router("/", &controllers.MainController{}) } diff --git a/tests/default_test.go b/tests/default_test.go index 296b56f..f5dc557 100644 --- a/tests/default_test.go +++ b/tests/default_test.go @@ -1,12 +1,12 @@ package test import ( + _ "go_ops/routers" "net/http" "net/http/httptest" - "testing" - "runtime" "path/filepath" - _ "devops/routers" + "runtime" + "testing" "github.com/astaxie/beego" . "github.com/smartystreets/goconvey/convey" @@ -14,11 +14,10 @@ import ( func init() { _, file, _, _ := runtime.Caller(0) - 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) } - // TestBeego is a sample to run an endpoint test func TestBeego(t *testing.T) { r, _ := http.NewRequest("GET", "/", nil) @@ -28,12 +27,11 @@ func TestBeego(t *testing.T) { beego.Trace("testing", "TestBeego", "Code[%d]\n%s", w.Code, w.Body.String()) Convey("Subject: Test Station Endpoint\n", t, func() { - Convey("Status Code Should Be 200", func() { - So(w.Code, ShouldEqual, 200) - }) - Convey("The Result Should Not Be Empty", func() { - So(w.Body.Len(), ShouldBeGreaterThan, 0) - }) + Convey("Status Code Should Be 200", func() { + So(w.Code, ShouldEqual, 200) + }) + Convey("The Result Should Not Be Empty", func() { + So(w.Body.Len(), ShouldBeGreaterThan, 0) + }) }) } -