Middleware tests.