improve roundcubelogin testability

Move cookie setting to helper method (see #270) and fix unit tests