单元测试

This commit is contained in:
des
2026-01-14 19:04:01 +08:00
parent c0054a9608
commit 69dad45d6a
7 changed files with 60 additions and 38 deletions

View File

@@ -0,0 +1,20 @@
package user_test
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
"github.com/gin-gonic/gin"
)
func TestLogin(t *testing.T) {
gin.SetMode(gin.TestMode)
app := gin.Default()
w := httptest.NewRecorder()
req, _ := http.NewRequest("POST", "/api/v1/user/login", nil)
app.ServeHTTP(w, req)
fmt.Println(w)
}