Make API tests run via tox

This patch makes some changes, that are needed to make the API tests
run with tox.