Added spies for the api test.