Preparing tests for middleware