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)
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
def test_otp_required(db_session): user = UserFactory() db_session.add(user) db_session.commit() assert otp_required(user.phone_number) == False