Moved Test API code to test