You've already forked CasaOS
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:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user