2017-07-02 17:51:17 +02:00

31 lines
605 B
Go

package main
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/aerogo/aero"
)
func TestRoutes(t *testing.T) {
app := configure(aero.New())
for _, examples := range routeTests {
for _, example := range examples {
request, err := http.NewRequest("GET", example, nil)
if err != nil {
t.Fatal(err)
}
responseRecorder := httptest.NewRecorder()
app.Handler().ServeHTTP(responseRecorder, request)
if status := responseRecorder.Code; status != http.StatusOK {
t.Errorf("%s | Wrong status code | %v instead of %v", example, status, http.StatusOK)
}
}
}
}