def test_not_authenticate_user(self): email = random_email() password = random_lower_string() user = crud.user.authenticate(db_session, email=email, password=password) assert user is None
def payload_normal_user(): return json.dumps({ "full_name": random_lower_string(), "email": random_email(), "password": random_lower_string(), "cpf": random_cpf(), })
def user_in(): email = random_email() password = random_lower_string() full_name = random_lower_string() cpf = random_cpf() return UserCreate(email=email, password=password, full_name=full_name, cpf=cpf)
def test_create_user(self): email = random_email() password = random_lower_string() full_name = random_lower_string() cpf = random_cpf() user_in = UserCreate(email=email, password=password, full_name=full_name, cpf=cpf) user = crud.user.create(db_session, obj_in=user_in) assert user.email == email assert hasattr(user, "hashed_password")
def test_check_if_user_is_superuser(self): email = random_email() password = random_lower_string() full_name = random_lower_string() cpf = random_cpf() user_in = UserCreate( email=email, password=password, full_name=full_name, cpf=cpf, is_superuser=True, ) user = crud.user.create(db_session, obj_in=user_in) assert user.is_superuser
def test_authenticate_user(self): email = random_email() password = random_lower_string() full_name = random_lower_string() cpf = random_cpf() user_in = UserCreate(email=email, password=password, full_name=full_name, cpf=cpf) user = crud.user.create(db_session, obj_in=user_in) authenticated_user = crud.user.authenticate(db_session, email=email, password=password) assert authenticated_user assert user.id == authenticated_user.id
def payload_admin_user(): return json.dumps({ "full_name": random_lower_string(), "email": random_email(), "password": random_lower_string(), })