make API configurable for testing, and add API tests