1
0
mirror of https://github.com/IceWhaleTech/CasaOS.git synced 2025-07-06 23:37:26 +02:00

feat: migrate gin to echo (#1854)

This commit is contained in:
Ns2Kracy
2024-06-04 14:14:55 +08:00
committed by GitHub
parent 0883f5f3aa
commit 8f7c99779f
18 changed files with 475 additions and 545 deletions

View File

@ -16,8 +16,8 @@ import (
"testing"
v1 "github.com/IceWhaleTech/CasaOS/route/v1"
"github.com/gin-gonic/gin"
"github.com/golang/mock/gomock"
"github.com/labstack/echo/v4"
"gotest.tools/assert"
)
@ -54,17 +54,22 @@ func performRequest(r http.Handler, method, path string) *httptest.ResponseRecor
func TestGetSambaSharesList(t *testing.T) {
t.Skip("This test is always failing. Skipped to unblock releasing - MUST FIX!")
gin.SetMode(gin.TestMode)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
executeWithContext := func() *httptest.ResponseRecorder {
response := httptest.NewRecorder()
con, ginEngine := gin.CreateTestContext(response)
// con, ginEngine := gin.CreateTestContext(response)
e := echo.New()
requestUrl := "/v1/samba/shares"
httpRequest, _ := http.NewRequest("GET", requestUrl, nil)
con := e.NewContext(httpRequest, response)
v1.GetSambaSharesList(con)
ginEngine.ServeHTTP(response, httpRequest)
e.ServeHTTP(response, httpRequest)
return response
}