mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
Test: Ping route
This commit is contained in:
20
routers/router_test.go
Normal file
20
routers/router_test.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package routers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPing(t *testing.T) {
|
||||||
|
asserts := assert.New(t)
|
||||||
|
router := InitRouter()
|
||||||
|
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
req, _ := http.NewRequest("GET", "/Api/V3/Ping", nil)
|
||||||
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
assert.Equal(t, 200, w.Code)
|
||||||
|
asserts.Contains(w.Body.String(), "Pong")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user