datarhei-dragonfork-core/http/handler/api/log_test.go

29 lines
495 B
Go
Raw Permalink Normal View History

2022-05-13 13:26:45 -04:00
package api
import (
"net/http"
"testing"
"github.com/datarhei/core/v16/http/api"
"github.com/datarhei/core/v16/http/mock"
2022-05-13 13:26:45 -04:00
"github.com/labstack/echo/v4"
)
func getDummyLogRouter() *echo.Echo {
router := mock.DummyEcho()
handler := NewLog(nil)
router.Add("GET", "/", handler.Log)
return router
}
func TestLog(t *testing.T) {
router := getDummyLogRouter()
response := mock.Request(t, http.StatusOK, router, "GET", "/", nil)
mock.Validate(t, []api.LogEvent{}, response.Data)
}