Port API tests to factory #20