单元测试
This commit is contained in:
20
srv/internal/user/controller_test.go
Normal file
20
srv/internal/user/controller_test.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user