Add login method and tests