Further refactors tests to avaoid touching the database