mirror of
https://github.com/datarhei/core.git
synced 2025-09-27 04:16:25 +08:00

Commits (Ingo Oppermann): - Add experimental SRT connection stats and logs - Hide /config/reload endpoint in reade-only mode - Add SRT server - Create v16 in go.mod - Fix data races, tests, lint, and update dependencies - Add trailing slash for routed directories (datarhei/restreamer#340) - Allow relative URLs in content in static routes Co-Authored-By: Ingo Oppermann <57445+ioppermann@users.noreply.github.com>
29 lines
506 B
Go
29 lines
506 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/datarhei/core/v16/http/mock"
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func getDummyPingRouter() *echo.Echo {
|
|
router := mock.DummyEcho()
|
|
|
|
handler := NewPing()
|
|
|
|
router.Add("GET", "/", handler.Ping)
|
|
|
|
return router
|
|
}
|
|
|
|
func TestPing(t *testing.T) {
|
|
router := getDummyPingRouter()
|
|
|
|
response := mock.Request(t, http.StatusOK, router, "GET", "/", nil)
|
|
|
|
require.Equal(t, "pong", string(response.Data.([]byte)))
|
|
}
|