Tests for .setup_middleware and .teardown_middleware.