Add tests for offerings API. Fix bugs