コード例 #1
0
 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
コード例 #2
0
def payload_normal_user():
    return json.dumps({
        "full_name": random_lower_string(),
        "email": random_email(),
        "password": random_lower_string(),
        "cpf": random_cpf(),
    })
コード例 #3
0
ファイル: conftest.py プロジェクト: eduleones/cashback-api
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)
コード例 #4
0
    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")
コード例 #5
0
    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
コード例 #6
0
    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
コード例 #7
0
def payload_admin_user():
    return json.dumps({
        "full_name": random_lower_string(),
        "email": random_email(),
        "password": random_lower_string(),
    })