mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
21 lines
514 B
Go
21 lines
514 B
Go
|
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)
|
||
|
e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal(expectedIndex)
|
||
|
e.GET("/a_notefound").Expect().Status(httptest.StatusNotFound).ContentType("text/html").Body().Equal(expectedNotFound)
|
||
|
}
|