Test invalid and successful authentication