Esempio n. 1
0
def test_check_otp(db_session):
    user = UserFactory()
    one_time_password = "".join(
        random.choices(string.ascii_letters + string.digits, k=8))
    user.set_password(one_time_password)
    db_session.add(user)
    db_session.commit()
    assert check_otp(user.phone_number, one_time_password)
Esempio n. 2
0
def test_create_message(db_session):
    msg = MessageFactory()
    user = UserFactory()
    msg.sender = user
    db_session.add(msg)
    db_session.commit()

    resp = db_session.query(Message).filter(Message.msg_id == msg.msg_id).all()
    len(resp) == 1
    assert resp[0] == msg
Esempio n. 3
0
def test_otp_required(db_session):
    user = UserFactory()
    db_session.add(user)
    db_session.commit()
    assert otp_required(user.phone_number) == False