Extract login/logout methods to their own class...

Refactor login/logout and profile tests to use them.