2020-08-22 07:04:22 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/kataras/iris/v12/httptest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestControllerHandleHTTPError(t *testing.T) {
|
|
|
|
const (
|
|
|
|
expectedIndex = "Hello!"
|
|
|
|
expectedNotFound = "<h3>Not Found Custom Page Rendered through Controller's HandleHTTPError</h3>"
|
|
|
|
)
|
|
|
|
|
|
|
|
app := newApp()
|
|
|
|
|
|
|
|
e := httptest.New(t, app)
|
2023-07-08 01:08:18 +02:00
|
|
|
e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual(expectedIndex)
|
|
|
|
e.GET("/a_notefound").Expect().Status(httptest.StatusNotFound).ContentType("text/html").Body().IsEqual(expectedNotFound)
|
2020-08-22 07:04:22 +02:00
|
|
|
}
|