Refactor client tests