Fixed the api unittest - it was not correctly running async call