Refactor unit test DB utils