Log in or init with insufficient user information#
!lamin close
import lamindb_setup as ln_setup
from lamindb_setup.dev._settings_store import (
current_user_settings_file,
get_settings_file_name_prefix,
settings_dir,
)
import pytest
Log in with in-sufficient information#
with pytest.raises(TypeError):
ln_setup.login()
If we add an email or handle it looks up the password from the stored env file (lamin login testuser1@lamin.ai
):
ln_setup.login("testuser1@lamin.ai")
Now, let’s start with a fresh environment without any user profiles stored.
(
settings_dir / f"{get_settings_file_name_prefix()}user--testuser1@lamin.ai.env"
).unlink()
(settings_dir / f"{get_settings_file_name_prefix()}user--testuser1.env").unlink()
current_user_settings_file().unlink()
If we try to login with a handle at first login, this will error:
with pytest.raises(RuntimeError):
ln_setup.login("testuser1", password="dummy")
If we try to login without password, this will error:
with pytest.raises(RuntimeError):
ln_setup.login("testuser1@lamin.ai")
If we try login with a wrong password, this will error:
from gotrue.errors import AuthApiError
with pytest.raises(AuthApiError):
ln_setup.login("testuser1@lamin.ai", key="hello")
Add back login for testuser1:
from laminci.nox import login_testuser1
login_testuser1("dummy_nox_session_arg")