Added unit tests for API stuff.