Tests for middleware
chdir screwup with the test