From 66d228f143d2a0b94041e93512870d5dbe2c2b2f Mon Sep 17 00:00:00 2001 From: yc Date: Wed, 12 Nov 2025 10:03:15 +0100 Subject: [PATCH] basic test update --- tests/default_test.go | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/default_test.go b/tests/default_test.go index 8b67ad4..af68695 100644 --- a/tests/default_test.go +++ b/tests/default_test.go @@ -3,37 +3,36 @@ package test import ( "net/http" "net/http/httptest" - "testing" - "runtime" - "path/filepath" _ "oc-discovery/routers" + "path/filepath" + "runtime" + "testing" - beego "github.com/beego/beego/v2/server/web" "github.com/beego/beego/v2/core/logs" + beego "github.com/beego/beego/v2/server/web" . "github.com/smartystreets/goconvey/convey" ) 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) } // TestGet is a sample to run an endpoint test func TestGet(t *testing.T) { - r, _ := http.NewRequest("GET", "/v1/object", nil) + r, _ := http.NewRequest("GET", "/oc/version", nil) w := httptest.NewRecorder() beego.BeeApp.Handlers.ServeHTTP(w, r) logs.Info("testing", "TestGet", "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) + }) }) } -