Refactor tests to remove pull request mock setup duplication.