basic test update
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
yc
2025-11-12 10:03:15 +01:00
parent f1444c8046
commit 66d228f143

View File

@@ -3,25 +3,25 @@ package test
import ( import (
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"testing"
"runtime"
"path/filepath"
_ "oc-discovery/routers" _ "oc-discovery/routers"
"path/filepath"
"runtime"
"testing"
beego "github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/core/logs" "github.com/beego/beego/v2/core/logs"
beego "github.com/beego/beego/v2/server/web"
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
) )
func init() { func init() {
_, file, _, _ := runtime.Caller(0) _, 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) beego.TestBeegoInit(apppath)
} }
// TestGet is a sample to run an endpoint test // TestGet is a sample to run an endpoint test
func TestGet(t *testing.T) { func TestGet(t *testing.T) {
r, _ := http.NewRequest("GET", "/v1/object", nil) r, _ := http.NewRequest("GET", "/oc/version", nil)
w := httptest.NewRecorder() w := httptest.NewRecorder()
beego.BeeApp.Handlers.ServeHTTP(w, r) beego.BeeApp.Handlers.ServeHTTP(w, r)
@@ -36,4 +36,3 @@ func TestGet(t *testing.T) {
}) })
}) })
} }