From e42bcf9c9aac843029286e5aae2f90610406ddd7 Mon Sep 17 00:00:00 2001 From: Mustafa eren Talan <110690535+MErenTalan@users.noreply.github.com> Date: Wed, 5 Jun 2024 22:56:00 +0300 Subject: [PATCH] Mocking input for verification code Solves issue #55 --- routers/auth.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/routers/auth.py b/routers/auth.py index ebeba59..d92d60f 100644 --- a/routers/auth.py +++ b/routers/auth.py @@ -1,4 +1,5 @@ import json +from unittest.mock import patch from typing import Optional, Dict from fastapi import APIRouter, Depends, Form from dependencies import ClientStorage, get_clients @@ -30,11 +31,10 @@ async def auth_login(username: str = Form(...), if timezone != "": cl.set_timezone_offset(timezone) - result = cl.login( - username, - password, - verification_code=verification_code - ) + # We're mocking the input + with patch('builtins.input', return_value=verification_code): + result = cl.login(username, password) + if result: clients.set(cl) return cl.sessionid