Use getToken() instead of deprecated token()
Use getApi() and setApi() in tests