Refactor authentication tests