middleware tests