Middleware tests