Remove duplicated code from tests and prepare for response_tests