Use nil error response for testing middleware execution.

This commit is contained in:
mikestefanello 2021-12-22 14:38:00 -05:00
parent 4b91ed2f70
commit fcf1800ac0
3 changed files with 7 additions and 11 deletions

View file

@ -33,7 +33,9 @@ func InitSession(ctx echo.Context) {
}
func ExecuteMiddleware(ctx echo.Context, mw echo.MiddlewareFunc) error {
handler := mw(echo.NotFoundHandler)
handler := mw(func(c echo.Context) error {
return nil
})
return handler(ctx)
}
@ -43,12 +45,6 @@ func AssertHTTPErrorCode(t *testing.T, err error, code int) {
assert.Equal(t, code, httpError.Code)
}
func AssertHTTPErrorCodeNot(t *testing.T, err error, code int) {
httpError, ok := err.(*echo.HTTPError)
require.True(t, ok)
assert.NotEqual(t, code, httpError.Code)
}
func CreateUser(orm *ent.Client) (*ent.User, error) {
seed := fmt.Sprintf("%d-%d", time.Now().UnixMilli(), rand.IntnRange(10, 1000000))
return orm.User.