wings/api/handlers_test.go
Jakob Schrettenbrunner 3d789c0541 api: better routes
2017-08-02 23:23:41 +02:00

35 lines
695 B
Go

package api
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)
func TestHandleGetIndex(t *testing.T) {
router := gin.New()
recorder := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/", nil)
router.GET("/", handleGetIndex)
router.ServeHTTP(recorder, req)
assert.Equal(t, http.StatusOK, recorder.Code)
}
func TestHandlePatchConfig(t *testing.T) {
router := gin.New()
recorder := httptest.NewRecorder()
req, _ := http.NewRequest("PATCH", "/", strings.NewReader("{}"))
router.PATCH("/", handlePatchConfig)
router.ServeHTTP(recorder, req)
assert.Equal(t, http.StatusOK, recorder.Code)
}