Add and refactor user login tests