Refactor Template tests