mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 05:02:11 +08:00
26 lines
481 B
Go
26 lines
481 B
Go
package apiAuth
|
|
|
|
import (
|
|
"bytes"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func init() {
|
|
gin.SetMode(gin.TestMode)
|
|
}
|
|
|
|
func Test_UserRegister(t *testing.T) {
|
|
res := httptest.NewRecorder()
|
|
c, _ := gin.CreateTestContext(res)
|
|
c.Request, _ = http.NewRequest("POST", "/", bytes.NewBufferString(`{"secret": "111", "platform": 1, "uid": "1", "name": "1"}`))
|
|
|
|
UserRegister(c)
|
|
|
|
assert.Equal(t, res.Code, 200)
|
|
}
|