Factor out test API client.