Refactor cli tests