def main(email, password, force): newWeather = getWeather() if (newWeather != readInFile('weather')) or force: login(email if email else readInFile('email'), password if password else readInFile('password')) if updateAllocations(newWeather): saveInFile('weather', newWeather)
def login(): if 'user_name' in request.json: user_name = request.json.get('user_name') else: raise GenericError("user_name not provided") return jsonify(user_service.login(user_name))
def post(self): parser = reqparse.RequestParser() parser.add_argument('AadharNo', required=True, type=int, help='AadharNo cannot be found') args = parser.parse_args() aadhar = args['AadharNo'] return jsonify(user.login(aadhar))
def post(self, request, data): success, result, errors = login( data["login_data"].email, data["login_data"].password ) if errors: return BadRequest(errors) return Ok(result)
def test_login_ok(): password = "******" with patch('services.user.get_user_by_email') as mock: user = build_user() user.password = hashpw(password, gensalt()) mock.return_value = user ok, data, errors = login("*****@*****.**", password) assert mock.call_count == 1 assert ok is True assert 'token' in data
def test_login_fail(): password = "******" with patch("services.user.get_user_by_email") as mock: user = build_user() user.password = hashpw(password, gensalt()) mock.return_value = user ok, data, errors = login("*****@*****.**", "bbb") assert mock.call_count == 1 assert ok is False assert "email" in errors
def displayLogin(): username = input('Username: '******'Password: '******'msg']) _uAuth.storeTokens(t_type='access', token=r.body['access_token']) return _pageLogged.menu()