Moved login stuff out to the test