Refactor eunit tests to have common setup/teardown